Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem getting Word Addin to see active document (Word 2000/SR2)

    I have a small Word Addin that is automatically loaded when a word document is loaded or a new one is created. I have a subrountine named AutoExec that is always run when a document is loaded or a new one is created but I have found that I cannot figure out what is the activedocument. Any ideas?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Problem getting Word Addin to see active document (Word 2000/SR2)

    Well, first, ActiveDocument is simply that: the document with the focus at that moment. You don't need to figure it out, Word automatically figures it out. What do you need to know about it or do with it?

    The AutoExec macro should only run when Word starts up for the first time. It may well be that no document is yet active when AutoExec runs, but I haven't experimented with it.

    If you are using AutoNew or AutoOpen, it can be difficult to determine which is the most recently created or opened document, or the next to last, but I'm probably missing the point here. Can you explain your question again?

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem getting Word Addin to see active document (Word 2000/SR2)

    Here is the problem we are trying to solve. We have many Word templates where we have developed VBA code and these templates are place on a client's machine in sub folders that are under the defined User template area. When a document is derived from one of these templates the user can send that document to a co-worker, who also has the templates installed under thier user template area, who is located in an office in another city or state and the idea ios for the co-worker to be able to work on the document and have full access to the VBA code. Now unlike Excel the Word VBA code remains with the template so when the co-worker attempts to open and use the docment the required template will not be found because the path to the template is not the same.

    So we are trying to develop a component( addin) that is installed when our templates are installed and when a word doc is opened it will check custom properties for a template name and then it will search, find and attach the template to the open document.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Problem getting Word Addin to see active document (Word 2000/SR2)

    Okay, you want to use the Application_DocumentOpen event in your add-in. The help on this is better in Word 2002. See DocumentOpen Event and the background chapter on events on MSDN. Oh, and here's a May 2003 article by Bill Coan, Take Control of Microsoft Word Through Events that looks good (okay, I only looked at the table of contents, but Bill's known to be a Word guru). Hope this helps.

    (P.S. Found this searching AutoOpen site:microsoft.com on Google, which led me to the events somehow... and a new search for documentopen site:microsoft.com)

Posting Permissions

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