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