'The following code requires a Userform with 1 Combobox and 3 labels
Option Explicit
'Note: To use in Word, change ActiveWorkBook to ActiveDocument in 3 locations **
'For a printed listing, refer to this item:
'http://www.vbaexpress.com/kb/getarticle.php?kb_id=547
Private Sub UserForm_Initialize()
Dim p
For Each p In ActiveWorkbook.BuiltinDocumentProperties '**
ComboBox1.AddItem p.Name
Next
ComboBox1.ListIndex = 0
End Sub
Private Sub ComboBox1_Change()
Label1.Caption = "Index is BuiltinDocumentProperties(" & ComboBox1.ListIndex + 1 & ")"
On Error Goto ClearData
Label3.Caption = ActiveWorkbook.BuiltinDocumentProperties(ComboBox1.ListIndex + 1) '**
If Label3.Caption = "" Then
Label2.Caption = ""
Else
Label2.Caption = "Current value is"
End If
Exit Sub
ClearData:
Label2.Caption = ""
Label3.Caption = ""
End Sub
|