Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting Event Listeners in Word Add In (Word 2k/XP)

    In my project, I created a Word Add In to monitor events from Application and CommandButton objects. Before it works, I have to set the event listeners. At first, I tried to set the listeners in a AutoExec macro. It works if I manually load the add in from Word menu. But if I load the add in from a C++ program, the AutoExec is not called.

    Can any one tell me how event listeners are initialized in a Word add in except the AutoExec macro?

    Thanx

  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: Setting Event Listeners in Word Add In (Word 2

    Is it an ordinary template or a COM Add-in?

    In a COM Add-in, there is a way to set the "on load" behavior. In my Outlook add-in, I right-clicked my Designer to access the code pane and created:
    <pre>Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
    ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
    ByVal AddInInst As Object, custom() As Variant)
    ' set up event handler for new Inspectors
    Call HandleInspector
    End Sub

    Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
    AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
    ' I don't know that anything needs to happen here
    End Sub</pre>

    Hope this helps.

  3. #3
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Event Listeners in Word Add In (Word 2

    Unfortunately, this is a template. I cannot use the COM Add In because there are macros overriding Word built-in commands.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Event Listeners in Word Add In (Word 2

    if the template is not in the startupfolder of word (options.DefaultFilePath(wdStartupPath)) it won't load automatically.
    either put it in the startup folder or use the add method of the addins object to load it.

Posting Permissions

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