Microsoft Office Tutorials and References
In Depth Information
Example 12-4. Outputting the IDs of Command-Bar Controls
Const maxid = 4000
fr = FreeFile
Open "d:\temp\ids.txt" For Output As #fr
' Create temporary toolbar
Set cbar = Application.CommandBars.Add("temporary", msoBarTop, _
False, True)
For i = 1 To maxid
On Error Resume Next ' skip if cannot add
cbar.Controls.Add Id:=i
Next i
On Error GoTo 0
For Each ctl In cbar.Controls
Print #fr, ctl.Caption & " " & ctl.Id
Next
cbar.Delete
Close #fr
Example 12-4 shows a small portion of the resulting file when the code is run on my system.
Appendix C , contains a complete list.
Example 12-4. Outputting the IDs of Command-Bar Controls
<Custom> 1
&Spelling... 2
&Save 3
&Print... 4
&New... 18
&Copy 19
Cu&t 21
&Paste 22
Open 23
Can't Repeat 37
&Microsoft Word 42
Clear Contents 47
Custom 51
&Piggy Bank 52
Custom 59
&Double Underline 60
Custom 67
Custom 68
&Close 106
AutoFormat 107
&Format Painter 108
Print Pre&view 109
Custom 112
&Bold 113
&Italic 114
&Underline
115
We will consider an example that uses built-in controls later in the chapter (at which time it should
become clearer just what a built-in control is.)
 
 
Search JabSto ::




Custom Search