CommandBar in Word 
Author Message
 CommandBar in Word

Hello, I have created a .dot template whit references to the following
Object Libraries:

- Visual Basic For Applications
- MS Word Object Library 8.0
- OLE Automation
- Microsoft Forms 2.0 OLB
- Microsoft Office 8.0 OLB

The user of the template gets a error  RTE 5981 Object or Library not found,
whit the code breaking on a routine that adds a CommandBar to the Word
Application.

I suspect that the Microsoft Office 8.0 OLB is not present. How do i deploy
the necessary OLB's to the user?
Or is there an other error that i don't see`???

Regards, Bent

Sub AddToolBar()
CustomizationContext = ActiveDocument            <- debug starts on this
line......

    Dim cbrWiz As CommandBar
   Dim ctlInsert    As CommandBarButton
   On Error Resume Next
   ' Determine whether command bar already exists.
   Set cbrWiz = CommandBars(CBR_INSERT)
   ' If command bar does not exist, create it.
   If cbrWiz Is Nothing Then
      Err.Clear
      Set cbrWiz = CommandBars.Add(CBR_INSERT)
      ' Make command bar visible.
      cbrWiz.Visible = True
      ' Add button control.
      Set ctlInsert = cbrWiz.Controls.Add
      With ctlInsert
         .Style = msoButtonCaption
         .Caption = CTL_INSERT
         .Tag = CTL_INSERT
         ' Specify procedure that will run when button is clicked.
         .OnAction = "ShowDocInfo"
      End With
'...Else
      ' Make sure the existing commandbar is visible
      cbrWiz.Visible = True
   End If

End Sub



Sun, 06 Jun 2004 15:23:30 GMT  
 CommandBar in Word
Hi Bent,

When exactly is this macro running? In an autoexec macro maybe? Could it be
that perhaps there is no document available when the macro runs?
Otherwise, which error do you get when compiling the code on this specific
system?

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/



Quote:
> Hello, I have created a .dot template whit references to the following
> Object Libraries:

> - Visual Basic For Applications
> - MS Word Object Library 8.0
> - OLE Automation
> - Microsoft Forms 2.0 OLB
> - Microsoft Office 8.0 OLB

> The user of the template gets a error  RTE 5981 Object or Library not
found,
> whit the code breaking on a routine that adds a CommandBar to the Word
> Application.

> I suspect that the Microsoft Office 8.0 OLB is not present. How do i
deploy
> the necessary OLB's to the user?
> Or is there an other error that i don't see`???

> Regards, Bent

> Sub AddToolBar()
> CustomizationContext = ActiveDocument            <- debug starts on this
> line......

>     Dim cbrWiz As CommandBar
>    Dim ctlInsert    As CommandBarButton
>    On Error Resume Next
>    ' Determine whether command bar already exists.
>    Set cbrWiz = CommandBars(CBR_INSERT)
>    ' If command bar does not exist, create it.
>    If cbrWiz Is Nothing Then
>       Err.Clear
>       Set cbrWiz = CommandBars.Add(CBR_INSERT)
>       ' Make command bar visible.
>       cbrWiz.Visible = True
>       ' Add button control.
>       Set ctlInsert = cbrWiz.Controls.Add
>       With ctlInsert
>          .Style = msoButtonCaption
>          .Caption = CTL_INSERT
>          .Tag = CTL_INSERT
>          ' Specify procedure that will run when button is clicked.
>          .OnAction = "ShowDocInfo"
>       End With
> '...Else
>       ' Make sure the existing commandbar is visible
>       cbrWiz.Visible = True
>    End If

> End Sub



Mon, 21 Jun 2004 23:15:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Deactivate "Send"-Button and make a CommandBar from Word visible

2. Dockable CommandBar in Word

3. CommandBars in Word Email Editor

4. CommandBar in Word 97

5. Commandbars in Word

6. Add a button to a CommandBar in Word using wsh

7. VB6 & Office programing problem (CommandBAr in WORD...)

8. Commandbars/toolbars not active in Word 2K

9. Word 2000, CommandBars and Accelerator Keys.

10. Word 2000 commandbar button

11. Dockable CommandBar Addin in Word

12. WebBrowswer - CommandBars for Microsoft Word

 

 
Powered by phpBB® Forum Software