Hoi,
I just solved the problem. When I define an unique string in the tag property of the commandbarbutton, it works for all documents.
cbb.tag = "UNIQUE"
"Hendrik Jan" wrote:
[Quoted Text] > Hi, > > In Ms Office 2000 we developed a dot file that crates a commandbar + > commandbarbutton in Ms Word. When you click on this button, the program > retrieves data from the database and puts it in your Ms Word document. Now we > are trying to build the same functionality in a dll. Therefore I started in > Office Developer 2000 a "addin" vba project. In the AddInDesigner I linked > the project to Ms Word with "Startup" as initial load behavior. In the code I > declared a commandbarbutton (Private WithEvents cbb As > Office.CommandBarbutton) that is placed in the commandbar in the > "IDTExtensibilty2_OnConnection". I copied the code (modules and forms) from > the dot file into modules and forms in this vba project. When I click the > commandbarbutton this code is started. When I start Ms Word the > commandbarbutton is created and clicking on it, the code starts as I want. > But this works only in the first document (document 1) in Ms Word. When I > create a new (document 2) document in Ms Word or I open a saved document, the > commandbarbutton is there, but when I click on it then nothing happens. > > Can anyone help me with this? > > Thanks, > Hendrik Jan
|