Home All Groups Group Topic Archive Search About
Author
6 Mar 2006 1:49 AM
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

Author
6 Mar 2006 10:47 AM
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


Show quoteHide quote
"Ron Dahl" <rd***@ghp.com> escribió en el mensaje
news:ua%23PqAMQGHA.1040@TK2MSFTNGP12.phx.gbl...
> 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
>
Author
6 Mar 2006 1:25 PM
Herfried K. Wagner [MVP]
"Ron Dahl" <rd***@ghp.com> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>