• DocumentChange event in Word 2000

    Author
    Topic
    #351652

    Hi,

    Has anybody had experience in using the DocumentChange event? I’m having a problem in getting it working in Word 2000.

    I used code from the MVPS site (http://www.mvps.org) as a guide- I’ve stripped it back as far as I can to reproduce the problem.

    I have an add-in in the Word startup directory. I have a DocumentChange event which is working well until I run a macro- and then it stops working.

    This is the code I have in the add-in:

    in form “Userform1” (a completely blank form):
    Private Sub UserForm_Initialize()
    End
    End Sub

    in module “main”:
    Dim oAppClass As New ThisApplication
    Public Sub AutoExec()
    Set oAppClass.oApp = Word.Application
    End Sub

    in module “ShowForms”:
    Public Sub ShowForms()
    UserForm1.Show
    End Sub

    In class module “ThisApplication”:
    Public WithEvents oApp As Word.Application
    Private Sub oApp_DocumentChange()
    MsgBox “DocumentChange”
    End Sub

    When I start up Word, I get the message “DocumentChange” as I would expect. I get it every time I create a new document, swap focus, or close a document, I get the message, again as I would expect.

    However, If I run “ShowForms” from the macro menu, the message does not get displayed until after I close down Word and reopen it.

    The same code works OK in Word 97.

    Reply To: DocumentChange event in Word 2000

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: