CVErr(xlErrValue)
https://xldennis.wordpress.com/2006/11/22/dealing-with-cverr-values-in-net-%e2%80%93-part-i-the-problem/
https://xldennis.wordpress.com/2006/11/29/dealing-with-cverr-values-in-net-part-ii-solutions/
For example, observe the following VB.NET code:
Dim rngA1 As Excel.Range = xlApp.Range("A1")
Dim rngB1 As Excel.Range = xlApp.Range("B1")
rngA1.Formula = "#N/A" ' rngA1.Value = #N/A
rngB1.Value = rngA1.Value ' rngB1.Value = -2146826246
Excel.xlCVErr Range.Value Coerced to .NET
------------- ----------- ---------------
2000 #NULL! -2146826288
2007 #DIV/0! -2146826281
2015 #VALUE! -2146826273
2023 #REF! -2146826265
2029 #NAME? -2146826259
2036 #NUM! -2146826252
2042 #N/A -2146826246
Imports System.Runtime.InteropServices
Module Helpervb
Enum CVErrEnum As Int32
ErrNull = -2146826288 '2000 #NULL!
ErrDiv0 = -2146826281 '2007 #DIV/0!
ErrValue = -2146826273 '2015 #VALUE!
ErrRef = -2146826265 '2023 #REF!
ErrName = -2146826259 '2029 #NAME?
ErrNum = -2146826252 '2036 #NUM!
ErrNA = -2146826246 '2042 #N/A
End Enum
Function CVErr(whichCVErr As CVErrEnum) As ErrorWrapper
Return New ErrorWrapper(whichCVErr)
End Function
End Module
참고자료
https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshalling-for-objects
https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshalling-behavior
https://docs.microsoft.com/ko-kr/dotnet/api/system.runtime.interopservices.errorwrapper?view=net-6.0
_