Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

External call to Word (as an object) to return a Custom property from a document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ian B - 31 Aug 2007 06:39 GMT
I need to obtain a custom property value from an active word document using
VB6. Test code shown below:
In VBA:
Dim myProp As DocumentProperty
For Each myProp In ActiveDocument.CustomDocumentProperties
   MsgBox myProp.Name
Next

In VB6
Errors on indicated line
Set oWord = GetObject(, "Word.Application")
Dim myProp As oWord.DocumentProperty <<<<<<<<<<<<<<<<<
For Each myProp In oWord.ActiveDocument.CustomDocumentProperties
   MsgBox myProp.Name
Next

What have I forgotten?

TIA

Ian B
Peter Jamieson - 31 Aug 2007 08:29 GMT
DocumentProperty is a member of the Office object, not the Word Application
(or Document) object. I don't have my copy of VB to hand but you probably
need to add a reference to the Office object and use something like

Dim oProp As New Office.DocumentProperty

Peter Jamieson

>I need to obtain a custom property value from an active word document using
> VB6. Test code shown below:
[quoted text clipped - 17 lines]
>
> Ian B
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.