#1
|
|||
|
|||
.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? |
#2
|
||||
|
||||
Hi Don,
Ideally, you'd locate the macro in the document's template; otherwise you'll need to open the document holding the code before you can access it - and you'd have to reference that other document as part of the macro's call.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PowerPoint 2010 not works | Democrazy | PowerPoint | 0 | 11-26-2010 03:05 AM |
VB code from one document runs on other open documents | beav_35 | Word VBA | 0 | 11-10-2010 02:52 PM |
Converting from Works | Menno Hershberger | Office | 0 | 09-01-2010 11:33 PM |
how can I add a peace of code to MS document | amlife | Word VBA | 0 | 03-03-2010 03:35 PM |
MS Works 2000 | mommu | Office | 4 | 01-23-2006 02:40 PM |