PDA

View Full Version : Solved: Word add-in not working when opening a document



santon
03-31-2005, 05:36 AM
Hello!

I have made a word add-in with IDTExtensibility2 interface. When I start word 2003 from start menu everything works fine. But when I open a "old" document it doesn?t.
The toolbar appears but with no function. Seems like word or xp remove assemblies when opening a document or something. Tried to save document with the working add-in, but when I opened it again same thing happened.

Thanks

santon
03-31-2005, 01:36 PM
Hello again!

I wonder if the problem I described in earlier post, that the add-in didn?t work when I opened a document, arrise because I don?t use the application.DocumentOpen event. This is what happends:

1. I start word
2.the commandbar appears
3.I test it and it works
4.I open a new document or a old
5.the commandbar still appears
6.I test it BUT it doesn?t work!

Can anybody help me out?

M-a-d-m-a-n
04-14-2005, 11:38 PM
Sorry, maybe someone else here knows...

Anne Troy
04-15-2005, 06:48 AM
Hi, Santon. I've merged your threads together. No need to start a new one, just reply to your old one.

Are you using a DOC or a DOT?

Killian
04-15-2005, 06:58 AM
If you want your toolbar & marcos available to all your documents, you need to save your file as a DOT and place it in the Word Startup folder (as defined in Word>Tools>Options>File Locations tab> STARTUP).
If you've created your toolbar/menus through Word then they will appear. If you build them with code, you'll have to call the toolbar building routine in Document_Open (plus anything else you want to run when the addin loads)
You won't be able to access the styles. If you use styles, these will need to be in a separate DOT file you either open from the toolbar or your templates directory.

Anne Troy
04-15-2005, 07:12 AM
Actually...
If you load a toolbar within a DOT file, you must ALSO call the toolbar in the Document_New event. The default "double-click" event of a DOT file is Document_New andfor a DOC file is Document_Open. So you must call it for BOTH if you want it to work both when creating a new doc from that template, or when opening the doc once it's already been created from that template.

:)

Styles can be saved in a template or a document.
Macros can be saved in a template or a document.
Autotext entries can only be saved in a template.

MOS MASTER
04-15-2005, 09:45 AM
Hi,:D

Check out these Word Addin Downloads/tutorials:
http://www.amosfivesix.com/downloads/

If you click home you also get more background on Com addins.
I'm shure these wil help you! :whistle:

santon
04-16-2005, 10:41 AM
Thanks for the help! I think you missunderstood me. I use the IDTExtensibility2 interface, not the vsto. With the vsto (visual studio tools for office) you can choose between making a template(dot) or a document (dot) project. But I wanted to make an addin for word. Now to the problem. It seems that when starting word by opening a document some combobox events wont work after startup. Therefor I had to call the onStartupComplete code again by pushing a button on the custom toolbar. Then it works. One extra click but thats ok. Toni.

MOS MASTER
04-16-2005, 10:56 AM
Hi, :D

Glad you made it work...you're welcome! :*)