Multiple Apps

Return BuiltInDocumentProperties for use in code

Ease of Use

Intermediate

Version tested with

2000, 2003 

Submitted by:

mdmackillop

Description:

Shows a simple userform which lists values and indexes of BuiltInDocumentProperties 

Discussion:

Check the values you need for creating your KB entries! 

Code:

instructions for use

			

'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

How to use:

  1. Create a userform with i combobox and 3 labels
  2. Copy the above code into the Userform code window
  3. Create a shortcut to open the userform
 

Test the code:

  1. Open the Userform
  2. Press the Down arrow to scroll throught all the properties
  3. The Index and Relevant values will be displayed
 

Sample File:

BuiltInProperties.zip 16.5KB 

Approved by mdmackillop


This entry has been viewed 75 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express