The applications in Microsoft Office 97 have toolbars whose commands display icons. These icons have unique identifying numbers called face IDs associated with them. By changing a command's face ID, you can change its icon. Finding the face ID for a command is a task you can complete with Office's programming language, Visual Basic for Applications, or VBA. One step involved in finding a command's face ID is querying objects of the Office 97 object model -- a network of virtual objects representing Office's programmable elements. Finding the face IDs for Office 97 toolbars is a first step toward customising command icons.
- Skill level:
Open one of the Office 97 applications, then press "Alt"+"F11" to enter the VBA integrated development environment, or IDE.
Click the "Insert" menu's "Module" command to open a new window for entering VBA source code.
Paste the following program code into the code window. This program prints out to the IDE's "Immediate" window, a list showing all toolbar buttons and their face IDs. The "CommandBars" function provides a list of toolbars. Each toolbar has a list of controls that your program accesses through the toolbar's "Controls" function. Since not all toolbar commands have icons, the program would cause an error if it tried accessing the face ID of these commands. The program catches this error with the "On Error" statement.
Public Sub showFaceIds()
Dim i, j, cur Bar
Dim s, curCtl
Debug.Print "Description|Summary|Type|Face id"
For i = 1 To CommandBars.Count
Set cur Bar = CommandBars(i)
For j = 1 To curBar.Controls.Count
Set curCtl = curBar.Controls(j)
s = curCtl.DescriptionText & "|" & curCtl.Caption & "|" & curCtl.Type
On Error Resume Next
s = s & "|" & curCtl.FaceId
Open the IDE's "Immediate" window by pressing "Control"+"G."
Click one of the program's statements, then click the "Debug" menu's "Run" command to execute the program. The "Immediate" window will fill with the face ID and other properties of each toolbar command.
Click inside the "Immediate" window, then select and copy all of its text.
Open Word 97. Paste the text you just copied.
Press "Control"+"A" to select all text, then click the "Table" menu's "Convert Text" item to open the dialogue box for converting plain text to a Word table. This conversion will make it easy to read the data.
Type "|" (the pipe symbol) in the textbox that says "Other," then press "Enter" to create the table.
Print out the document, then surf to the MSDN "Type Enumeration" page, which names each of the command button types referred to by your printout's "Type" column.
Read the printout as follows: the first column relates the command's function, such as "Cut the Selection." The second column summarises that function. The third is a number representing the type of command (e.g., "Command Button," "Combo Box"). Refer to the page you surfed to in the last step to associate a name with this number. The printout's last column relates the face ID of the command.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for