Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Intercept Document_Open (Win XP Word 2003)

    I have a global template in Word's the startup folder.

    I know I can do so if I have a .dot file in which I place a procedure called "Document_Open()" and the code inside this will execute when a document is opened.

    But... How can I write a procedure in the global template that intercepts opening a document?
    It does not work with "Document_Open()".

    Rgds
    Bj

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Intercept Document_Open (Win XP Word 2003)

    You need an application-level event handler for DocumentOpen for this. See <post#=320550>post 320550</post#> for an example. But if I remember correctly, you are using some kind of document retrieval system, and that might well interfere with the application-level event handler. I don't know how to solve that.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Intercept Document_Open (Win XP Word 2003)

    (This may be a double post, I answered on Post: 320550)

    Thanks Hans!

    I have tried this but cannot get it working.


    <Public Sub FixDoc(doc As Document)
    < With doc.ActiveWindow
    < .DocumentMap = True ' What exactly does these two methods?
    < .DocumentMap = False
    < End With
    <End Sub

    <3. Put the following code in ThisDocument: ' I presume "ThisDocument" is the module "ThisDocument" in the Global template?
    The document I'm opening does not have areference to a .dot file and thus cannot know anything about the code.

    This procedure in "ThisDocument" will not run:
    Private Sub Document_Open()
    Set myCls.app = Application
    MsgBox "Open works"
    End Sub

    Rgds
    Bj

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Intercept Document_Open (Win XP Word 2003)

    Please keep to one thread.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Intercept Document_Open (Win XP Word 2003)

    Discussion has been continued in <post#=367892>post 367892</post#> and further. I am locking this thread to avoid confusion and duplication.

Posting Permissions

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