Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating toolbar macro errors
Hello. Below is some Dave Peterson code that I found (and modified). I simply
want to create a floating toolbar with one button for my macro. However, whenever I start Excel or uninstall/install this add-in, it errors out on naming the commandbar. I get "Invalid procedure call or argument". It seems to be naming the commandbar "Custom 1", and then it won't rename it. I'm puzzled. thanks. '=========================================== Sub Auto_Open() Call CreateMenubar End Sub '=========================================== Sub Auto_Close() Call RemoveMenubar End Sub '=========================================== Sub RemoveMenubar() On Error Resume Next Application.CommandBars("View").Delete On Error GoTo 0 End Sub '=========================================== Sub CreateMenubar() Call RemoveMenubar With Application.CommandBars.Add .Name = "View" '<<<<<<<<<Errors here .Left = 200 .Top = 200 .Protection = msoBarNoProtection .Visible = True .Position = msoBarFloating With .Controls.Add(Type:=msoControlButton) .OnAction = "'" & ThisWorkbook.Name & "'!" & "Unhide_All_WS" .Caption = "Unhide All Sheets" .Style = msoButtonIconAndCaption .FaceId = 229 End With End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating ranges in closed workbooks without #REF errors | Excel Discussion (Misc queries) | |||
Creating macro button on toolbar | Excel Programming | |||
Creating a macro that simulates some of the toolbar button | New Users to Excel | |||
Sort creating total errors | Excel Discussion (Misc queries) | |||
Creating a Toolbar with a macro | Excel Programming |