Command Bar & Button Difficulties 
Author Message
 Command Bar & Button Difficulties

I would like to create a command bar  with just one button every time i open
a specific document.  So therefore i create the runt eh following procedure
in the document code:

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
    CreateCommandBar

End Sub

The procedure CreateCommandBar is in my module1:
Public Sub CreateCommandBar()
    Dim cbrcmdbar As CommandBar
    Dim cbButton As CommandBarButton
    'create temporary toolbar that doesnt persist between applications
    Set cbrcmdbar = Application.CommandBars.Add(Name:="CustomToolBar")

    If cbrcmdbar.Enabled = True Then
        cbrcmdbar.Visible = True
    End If

    Set cbButton = cbrcmdbar.Controls.Add(Type:=msoControlButton)
    With cbButton
        .Caption = "Output File Preview"
        .FaceID = 7075
        .OnAction = "thisdocument.printunitcode"
        .Tag = "cbbVBAMacro"
    End With

End Sub

When i open the document i get the following error:
"Runtime Error 5
Invalid Procedure Call or Argument
"

When I debug it points to the procedure above:
-- Set cbrcmdbar = Application.CommandBars.Add(Name:="CaseToolBar") --



Thu, 04 Nov 2004 05:13:12 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Command Bar Button

2. disapearing button on command bar

3. Invoking a command button from a menu bar

4. FaceID for command bar buttons

5. Command Bar Button .OnAction Property not working...

6. Custom Command Bar Buttons

7. Add image to command bar button

8. Need command bar button that loads/unloads DOT add-in

9. Enabling command bar buttons based on doc open or not

10. Changing Control Button Icons on Command Bar

11. Scroll bars for form w/ text boxes and command buttons

12. Command Bar Button HELP please!

 

 
Powered by phpBB® Forum Software