Custom Toolbars Again!!!
Gary and Doug - thanks so much - helped a lot and will make the toolbar on
the fly.
--
Sharon
"Doug Glancy" wrote:
Sharon,
Here's a template for doing what Gary suggests. (j-walk's site will be more
complete).
You would paste this code into the ThisWorkbook module:
Private Sub Workbook_Activate()
Call make_menu
End Sub
Private Sub Workbook_Deactivate()
Call delete_menu
End Sub
Sub make_menu()
Dim cbar As CommandBar
Dim cbarcontrol As CommandBarControl
'delete the previous version if it exists
Call delete_menu
Set cbar = Application.CommandBars.Add(Name:="tester", temporary:=True)
cbar.Visible = True
Set cbarcontrol = cbar.Controls.Add(Type:=msoButtonIcon)
With cbarcontrol
.FaceId = 2
.OnAction = "tester"
End With
End Sub
Sub delete_menu()
On Error Resume Next
Application.CommandBars("tester").Delete
On Error GoTo 0
End Sub
Then create a macro "tester" in a regular module:
Sub tester
msgbox "tester"
End Sub
hth,
Doug
"Sharon" wrote in message
...
Sorry to be a pain about this. The custom toolbar I created is displaying
when the workbook opens and hidden when the workbook closes, which is
fine.
I then wanted to copy the workbook to another location with another name,
and
attached the toolbar to the new workbook. However, the damn thing keeps
looking back to the original workbook for the macros. Is the only way to
create a new toolbar name for each workbook?
--
Sharon
|