K
Ken Valenti
I want to distribute code that will work on any document in Word 2003.
This code will add a new command bar with one button.
Sub AddToolBar()
Dim Mybar As CommandBar
Set Mybar = CommandBars.Add(Name:="Test Menu", Position:=msoBarFloating,
temporary:=True)
Mybar.Visible = True
With Mybar.Controls.Add
..Style = msoButtonCaption
..Caption = "Test Macro"
..OnAction = ThisDocument.Name & "!RunThisMacro"
End With
End Sub
The button will run the macro fine, but only on the docuement containing the
macro.
The macro won't run when a different docuement is active
Since I need to distribute this to other people, I don't want to modify the
normal.dot.
Do I need to create an addp-in or ???
This code will add a new command bar with one button.
Sub AddToolBar()
Dim Mybar As CommandBar
Set Mybar = CommandBars.Add(Name:="Test Menu", Position:=msoBarFloating,
temporary:=True)
Mybar.Visible = True
With Mybar.Controls.Add
..Style = msoButtonCaption
..Caption = "Test Macro"
..OnAction = ThisDocument.Name & "!RunThisMacro"
End With
End Sub
The button will run the macro fine, but only on the docuement containing the
macro.
The macro won't run when a different docuement is active
Since I need to distribute this to other people, I don't want to modify the
normal.dot.
Do I need to create an addp-in or ???