Listing Objects (from various collections) Programatically:   Return to List

Public Sub Main()
Dim myObject As Template
For Each myObject In Word.Templates' This lists the active ones
    MsgBox myObject.Name
Next
End Sub

Other Objects which Can be Listed
Dim myObject As CommandBar
For Each myObject In Word.CommandBars' Lists all available Command Bars
    MsgBox myObject.Name
Next

Dim myObject As Window
For Each myObject In Word.Windows
    MsgBox myObject.Caption' Lists open Windows within Word -- many properties could be manipulated (other than caption)
Next

' Plus many more ==> Simply beginning the above in VBE and entering a period will cause the options to appear.



Note to Webmaster