{System.__ComObject}

R

Ron Dahl

In Word VBA the expression "ActiveDocument.Paragraphs(1).Style returns
"Heading 3"

In VB.Net the expression "appWord.ActiveDocument.Paragraphs(1).Style"
returns "{System.__ComObject} [System.__ComObject]: {System.__ComObject}"

How can I get vb.net to return "Heading 3" instead of "{System.__ComObject}
[System.__ComObject]: {System.__ComObject}".

Thanks in advance for any help.

Ron Dahl
 
C

Carlos J. Quintero [VB MVP]

Hi Ron,

When .NET objects need to interact with COM objects, they use "wrappers" and
sometimes when querying the type you get "System.__ComObject". To know the
actual type behing a __ComObject, use:

Microsoft.VisualBasic.Information.Typename(variable)

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
H

Herfried K. Wagner [MVP]

Ron Dahl said:
In Word VBA the expression "ActiveDocument.Paragraphs(1).Style returns
"Heading 3"

In VB.Net the expression "appWord.ActiveDocument.Paragraphs(1).Style"
returns "{System.__ComObject} [System.__ComObject]: {System.__ComObject}"

How can I get vb.net to return "Heading 3" instead of
"{System.__ComObject} [System.__ComObject]: {System.__ComObject}".

Use 'ActiveDocument.Paragraphs(1).Style.NameLocal' instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top