Word add-in

  • Thread starter Wilfried Walpot
  • Start date
W

Wilfried Walpot

Hello,

I have made an add-in for Word 2000 with VB6. In this add-in I make a commandbar, add a button to the tools menu, i disable the buttons new,open,save as,... and I also disable the shortcuts using the keybinding objects for ctrl+N,ctrl+O,... Now when i disconnect/close word i throw away the commandbar, remove the button in the menu and clear the keybindings en enable the menu's again. When i start word without loading my add-in my commandbar appears but i have deleted it, I have found out that if I put the code for disable the keybindings in comment all goes well. Is there a known conflict between those things?

Thanx

Wilfried Walpot
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?V2lsZnJpZWQgV2FscG90?=,

Most often, this problem occurs because the CustomizationContext of the application object
wasn't set before working with the commandbar and keybinding objects. You have to tell Word
in what "container" the changes should be saved: the activedocument, its attachedtemplate,
normaltemplate or another global template.
I have made an add-in for Word 2000 with VB6. In this add-in I make a commandbar, add a
button to the tools menu, i disable the buttons new,open,save as,... and I also disable the
shortcuts using the keybinding objects for ctrl+N,ctrl+O,... Now when i disconnect/close
word i throw away the commandbar, remove the button in the menu and clear the keybindings
en enable the menu's again. When i start word without loading my add-in my commandbar
appears but i have deleted it, I have found out that if I put the code for disable the
keybindings in comment all goes well. Is there a known conflict between those things?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 
W

Wilfried Walpot

Hi,

Thanx for your answer. I have thought of that too, but when the onconnection event of the add-in is triggered I haven't got an active document yet, so when i replace Word.Appliction by Word.Application.ActiveDocument it says there isn't an active document yet. Hoz do I have to handle this?

Thanks at advance

Wilfried Walpot
Admicom Systems
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?V2lsZnJpZWQgV2FscG90?=,
I have thought of that too, but when the onconnection event of the add-in is triggered I
haven't got an active document yet, so when i replace Word.Appliction by
Word.Application.ActiveDocument it says there isn't an active document yet. Hoz do I have to
handle this?You don't want to "replace" Word.Application, I don't think (haven't seen your code, or
course). But you do want to do something like this

wdapp as Word.Application
wdapp = New word.Application
'Put a loop here that continues until this line no longer gives an error:
doc as Word.Document = wdapp.ActiveDocument
'After the loop
wdapp.Customizationcontext = doc

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 
W

Wilfried Walpot

Hi, I have add the toolbar and stuff to the active document by using the IDTExtensibility2_OnStartupComplete event. This works, except for the key bindings are only to be set at the application container and not the activedocument. At least that is my conclusion. And this messes still goes wrong. Also I found that when I start Word from my application it loads my add-in well and does the things he has to do on the active document, but when i leave this instance open and choose to open Word from Start-Programs-Microsoft Word it also has the toolbar,the button and the disabled menu's although i programmed everything on the ActiveDocument instread of Application. Any idea what I'm doing wrong? How can I capture this so I can hide my toolbar, etc.

Thanks

Wilfried Walpot
Admicom Systems
 

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