MS Word toolbar

O

Oliver Young

I've added one toolbar with one button on MS Word, but when I restart MS
Word toolbar doesn't show up, so I have to right-click on the MS Word
toolbar area and add it again. I have set for "LoadBehavior" registry value
3. I have tried values 1, 2 and 8, and toolbar shows on MS Word startup, but
there is no button handler OnClick event.

Any help would be appreciated.

Milan
 
C

Chris Jensen [MSFT]

Hello Milan

Your post alludes to two problems. They seem to be mutually exclusive.

You say

1: I've added one toolbar with one button on MS Word, but when I restart MS
Word toolbar doesn't show up, so I have to right-click on the MS Word
toolbar area and add it again. << I don't know how you add a toolbar this
way>>

and

2: I have set for "LoadBehavior" registry value 3
. ... and toolbar shows on MS Word startup, but
there is no button handler OnClick event. << It sounds like the toolbar
shows, but the button was declared without "with events", or you haven't
written a Button_click(... event handler.>>

You don't say what developer's language you are using, so let me recommend
Microsoft Knowledge Base articles for several languages. Choose the
appropriate article and follow the suggested example in it to the letter.
Once your COM Add-in works correctly then you can add to it to fit your
particular needs.

238228 HOWTO: Build an Office 2000 COM Add-In in Visual Basic
http://support.microsoft.com/?id=238228

302896 HOW TO: Build an Office COM Add-in by Using Visual Basic .NET
http://support.microsoft.com/?id=302896

230689 SAMPLE: Comaddin.exe Office 2000 COM Add-In Written in Visual C++
http://support.microsoft.com/?id=230689

302901 HOW TO: Build an Office COM Add-in by Using Visual C# .NET
http://support.microsoft.com/?id=302901

also, please see

230876 BUG: CommandBar Control Reference Becomes Invalid Before COM Add-In's
http://support.microsoft.com/?id=230876

Chris Jensen (Microsoft)
 
O

Oliver Young

Thank you very much Chris. To bad that there are only few people helping us
in this newsgroup.
1: I've added one toolbar with one button on MS Word, but when I restart MS
Word toolbar doesn't show up, so I have to right-click on the MS Word
toolbar area and add it again.
<< I don't know how you add a toolbar this way>>
I add it like any other MS Word toolbar. Just right click on the toolbar
area and select from popup menu "Standard" or "Formatting".
You don't say what developer's language you are using, so let me recommend
Microsoft Knowledge Base articles for several languages. Choose the
appropriate article and follow the suggested example in it to the letter.
Once your COM Add-in works correctly then you can add to it to fit your
particular needs.
Thank you for those links. I'll take a look. I'm using VC++ 6.

Best regards,
Milan
 
O

Oliver Young

230689 SAMPLE: Comaddin.exe Office 2000 COM Add-In Written in Visual C++
http://support.microsoft.com/?id=230689
I'm talking about this project. The problem is that toolbar does not show on
startup of MS Word. I have to right click on toolbar area with mouse and add
my toolbar every time I open MS Word. I'd like that toolbar to show on
startup of MS Word. So, I set value 2 for "LoadBehavior" and toolbar shows
on startup of MS Word, but there is no button event handler for my button
(on the toolbar). Here is what I have changed in the project mentioned
above, from:

RegisterCOMAddin("Word", pszProgID, pszFriendlyName, 3);

to

RegisterCOMAddin("Word", pszProgID, pszFriendlyName, 2);
 
C

Chris Jensen [MSFT]

Hello Oliver,

You'll see in the article

238228 HOWTO: Build an Office 2000 COM Add-In in Visual Basic
http://support.microsoft.com/?id=238228

a discussion of LoadBehavior.

You want your COM Add-in to load at startup. LoadBehavior 2 sets that.
However, it isn't connected yet.

Adding 1 to 2 gives you the combination of
2 = Bootload
and
1= Connected - Is loaded.

The results you want should be the sum of those two, or 3.

If you use that, and after starting the application you see in the registry
that the loadbehavior is now 2 you must interpret that change as meaning
"Word tried to load the COM Add-in, but couldn't complete the load and so
it unloaded and changed the registry."

This is caused by some problem in the COM Add-in. If the add-in isn't
structurally perfect the application won't load it. It dumps it and
modifies the registry.

If the COM Add-in is loaded for the current user (not all users) it can be
listed in the COM Addin dialog which is accessible in the Word Tools menu.
If you do add it to the list there, and it has a checkbox that won't stay
checked you have the problem. There's some error in the COM Add-in.

By the way, the article above is a good introduction to COM Add-ins even if
you don't use Visual Basic. The VC++ article

230689 SAMPLE: Comaddin.exe Office 2000 COM Add-In Written in Visual C++
http://support.microsoft.com/?id=230689

has an identical discussion of the LoadBehavior registry key.

Chris Jensen (Microsoft)
 
O

Oliver Young

Thank you very much for so detailed response.
a discussion of LoadBehavior.

You want your COM Add-in to load at startup. LoadBehavior 2 sets that.
However, it isn't connected yet.

Adding 1 to 2 gives you the combination of
2 = Bootload
and
1= Connected - Is loaded.

The results you want should be the sum of those two, or 3.
I understand it now.
230689 SAMPLE: Comaddin.exe Office 2000 COM Add-In Written in Visual C++
http://support.microsoft.com/?id=230689
I am using that project as template for my project from beginning. I've
added only few, not important, changes.
My Probem is that when I set 3 for LoadBehavior my COM is connected on Word
start up and I can click on my button (on my toolbar) and it will invoke
button handler. The only problem here is that my toolbar is invisible when
Word starts. I have to click with right mouse button on Word toolbar area
and select it ("My Toolbar") from popup menu (place where you add/remove
standard Word toolbars) to show it. How can I force my toolbar to be visible
on Word startup? When I set 2 for LoadBehavior my toolbar is visible on Word
starup, but COM will not be loaded and when I click on my button, nothing
will happen.

Once again: How can I force my toolbar to be visible on Word startup? Btw,
it is visible on first Word starup (after installation), but on every other
Word startup it is invisible.
 
C

Chris Jensen [MSFT]

Hello Oliver,

Perhaps you have more toolbars and CommandBar controls than Word has space
for. What happens when you maximize Word? If you load the Normal.dot
template, simplify the toolbar (use the view menu to control the toolbars
that are loaded) then save Normal.dot as the template, then the next time
you start work does your commandbutton show on your toolbar?

Chris Jensen (Microsoft)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top