PDA

View Full Version : Finding constants for BuiltinDocumentProperties(index)



Gavint
01-31-2008, 10:40 PM
Can any one tell me how to find a list of the valid constants for BuiltinDocumentProperties?

Help says to look in the Object Browser, but I'm not sure how to drill further into the member to find the valid constants? (perhaps this is the lesson I need :dunno )

I know a couple of the obvious ones eg wdPropertyWords as in ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)

and I know how to return them all eg Dim dp As DocumentProperty
Dim tempstring As String

For Each dp In ActiveDocument.BuiltInDocumentProperties
On Error Resume Next 'reading uninitialized value causes an error
tempstring = tempstring & dp.NAME & ": " & dp.Value & vbLf
Next

'To MsgBox
MsgBox tempstring

However, this just gives a list of the "Names" and "Values", which is no help in returning a couple of specific ones.

Gavint
01-31-2008, 11:39 PM
I've played a little further and found that I can use the actual "Name" as opposed to the specific "wdproperty..."

eg ActiveDocument.BuiltInDocumentProperties("Creation Date")

So for this project I have aworking solution. Still, can anyone point in the right direction for determining constants via the Object Browser? I'm sure this would be quite useful :bow:

fumei
02-04-2008, 10:33 AM
I am not quite understanding the question. What do mean by determining constants? Do you mean the constant numeric value? Not its set value, but the value of the constant itself?

ActiveDocument.BuiltInDocumentProperties(15)
ActiveDocument.BuiltInDocumentProperties(wdPropertyWord)

are exactly equivalent, as the constant numeric value - NOT its set value - is 15.

To get them all, in the Object Browser, type:

wdProperty

in the search box. Make sure you have <All Libraries> as the search criteria. All wdProperty..... are listed.

To get the constant value, select one. The constant numeric equivalent will show at the bottom of the Object Browser.

If it would help, find attached a Word document listing ALL constants in Word 2002. It is 30 pages! Note, the attached document lists the constant's Name, and the corresponding numeric value...again NOT the variable value.

It does NOT list the parent object associated with the constant. So, for example, you can see:

wdFormatDOSTextLineBreaks = 5
wdFormatRTF = 6
wdFormatUnicodeText = 7
wdFormatEncodedText = 7
wdFormatHTML = 8
wdFormatWebArchive = 9
wdFormatFilteredHTML = 10

But that does NOT tell you that it is a constant used with wdSaveFormat. You can find this out easily though, again, with the Object Browser.