I am porting an old excel addin that was written in VBA for VB.NET. Excel addin interacts with several external COM objects. Code sorting looks like this:
Dim hurr as Object
Dim durr as String
hurr = CreateObject("COM Object")
durr = hurr.getString
What I'm trying to do is read a line from a COM object and get it in durr for use later in my program.
This second line leads to the exception posted above. If I try casting with CStr / CType, I get the same exception. The visual studio viewport reports the type hurr.getString as "System .__ ComObject", while the VBA viewer reports the type as "Option / Object / String". Microsoft.VisualBasic.Information.TypeName (hurr.getString) says the type is "String". Any ideas on how I should work on this?
Thank!
source
share