PDA

View Full Version : Solved: FaceIDs don't change in Word 2010 Macro



janaboo13
01-25-2012, 09:22 AM
Greetings!
We've recently migrated to Word 2010 from Word 2003 and I'm having trouble changing the icons in the drop-down list. The good news is this - the macros work still work great.

I was a bit annoyed when Word 2010 put the macro generated menu commands in the Add-Ins tab, but I've resigned myself to this. If I had the resources, I'd use the customizationUI (as described in the MS developer posts), but I don't have the energy :bug: !

The following code was used in Word 2003. I'd like to change the FaceID icons associated with each of the subroutines. If anyone can help, I'd be so appreciative!

Jan

'This macro creates the Post-Processing menu Sub AddMenuItem()

Dim ItemExists As Boolean

'Add a menu bar item for easy access to macro
CustomizationContext = ActiveDocument.AttachedTemplate

ItemExists = False

'Reset command bar to get rid of any other custom menus
CommandBars("Menu Bar").Reset

'If menu does not already exist, then go to SkipTo. If it does already exist, set ItemExists.
On Error GoTo SkipTo
If CommandBars("Menu Bar").Controls("Post-Processing").Visible = True Then
ItemExists = True
End If

SkipTo:

On Error GoTo ErrorHandler
If ItemExists = False Then
'add a menu to the Menu Bar
With CommandBars("Menu Bar").Controls
.Add(Type:=msoControlPopup).Caption = "&Post-Processing"
End With

'add commands to the new menu
With CommandBars("Menu Bar").Controls("Post-Processing").Controls

Set myButton = .Add(Type:=msoControlButton)
myButton.FaceId = 2112
myButton.Caption = "Modify font sizes..."
myButton.OnAction = "SetStyles"
myButton.BeginGroup = True

Set myButton = .Add(Type:=msoControlButton)
myButton.FaceId = 215
myButton.Caption = "Clean Up Document..."
myButton.OnAction = "ShowCleanUp"

Set myButton = .Add(Type:=msoControlButton)
myButton.FaceId = 984
myButton.Caption = "Post-Processing Help"
myButton.OnAction = "ShowHelp"
myButton.BeginGroup = True

End With

End If
Exit Sub
ErrorHandler:
'Display the error
msg = "Ooops! Something didn't work quite right." & Chr(13) & Chr(13) & _
"Error number: " & Err.Number & Chr(13) & _
"Error message: " & Err.Description & Chr(13) & Chr(13) & _
"The Post-Processing menu may not have been created correctly."
MsgBox msg, vbOKOnly + vbCritical, "AuthorIT Publisher"
End Sub