Consulting

Results 1 to 9 of 9

Thread: Solved: Word add-in not working when opening a document

  1. #1
    VBAX Newbie
    Joined
    Mar 2005
    Posts
    3
    Location

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

    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

  2. #2
    VBAX Newbie
    Joined
    Mar 2005
    Posts
    3
    Location

    Question Problems with word add-in and IDTExtensibility2

    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?

  3. #3
    Sorry, maybe someone else here knows...

  4. #4
    Site Admin
    The Princess
    VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    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?
    ~Anne Troy

  5. #5
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    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.
    K :-)

  6. #6
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    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.
    ~Anne Troy

  7. #7
    Administrator
    VP-Knowledge Base VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi,

    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!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  8. #8
    VBAX Newbie
    Joined
    Mar 2005
    Posts
    3
    Location
    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.

  9. #9
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi,

    Glad you made it work...you're welcome!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •