View Single Post
 
Old 10-25-2011, 11:28 AM
donbexcel donbexcel is offline Windows 2K Office 2007
Novice
 
Join Date: Oct 2011
Posts: 3
donbexcel is on a distinguished road
Unhappy .OnAction only works in document with the code

I'm using Word version 2007.

I created a new command bar control that calls a macro like this:
With cbcNewMenu.Controls.Add(Type:=msoControlButton)
.Caption = "ConvertTable"
.OnAction = "mod100Procs.UpdateTable"

End With

The macro only works on the document that contains the VBA code. If I try to use it on any other document I get a "The macro cannot be found... message.

I've tried this:

With cbcNewMenu.Controls.Add(Type:=msoControlButton)
.Caption = "ConvertTable"
.OnAction = "'" & Thisdocument.name & "'!mod100Procs.UpdateTable"

End With

but that doesn't work. What am I missing?
Reply With Quote