开发者

Interfacing Between C# And Excel?

开发者 https://www.devze.com 2022-12-11 19:27 出处:网络
I am using C# interop to call a mac开发者_StackOverflowro from C#. This works fine. However I am passing in an argument which the macro populates in the event of an error.

I am using C# interop to call a mac开发者_StackOverflowro from C#.

This works fine.

However I am passing in an argument which the macro populates in the event of an error.

app.Run(macroName, errrObj, Type.Missing, Type.Missing, Type.Missing, ........);

Is there any way to get C# to actually read the new value that the arg is set too?

Am I doing this wrongly??

The macro simply does this

Public sub abc(errorObj as variant)
errorObj = "HELLO WORLD"
End Sub


No, according to the IDL, this parameter is In. There is no way to read it from C#. Alternatively, try to use a global variable:

Dim errorObject as String

Function GetError As String
    GetError = errorObject
EndFunction

Funcion func(...)
   ...
   errorObject = ....
End Function
0

精彩评论

暂无评论...
验证码 换一张
取 消