Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    AutoMacros in an addin (Office 2000)

    Hi

    I have all my macros in an addin, a shortcut to which resides in the Word startUp folder.

    I've created an AutoNew macro (in the addin template), but it doesn't get activated when I go File|New and select "Blank document". I presume this means I'll have to put the AutoOpen macro into my Normal template.

    Is this right, or am I missing something?

    Thanks
    Dale

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoMacros in an addin (Office 2000)

    Better yet, why not put

    Sub FileNewDefault()
    On Error GoTo UseRealNormal
    Documents.Add (Options.DefaultFilePath(wdWorkgroupTemplatesPath) + "FirmNormal.dot")
    ActiveDocument.AttachedTemplate.Saved = True
    ActiveDocument.Saved = True
    Exit Sub
    UseRealNormal:
    Documents.Add
    ActiveDocument.Saved = True
    End Sub

    in your global app. That way all users who load the add-in at
    startup will be sure to use the company version of a blank
    document which you have doctored up with the right font,
    margins, macros, etc..
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    BAM
    Guest

    Re: AutoMacros in an addin (Office 2000)

    Hi Dale,

    AutoNew only works for all new documents if placed in Normal.dot only.

    For your global template you can use the NewDocument event instead.
    ~~~~~~~~~~~~~
    Cheers!

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: AutoMacros in an addin (Office 2000)

    And for more on document events and faking AutoNew, AutoOpen, etc from global add-ins . . .
    See <A target="_blank" HREF=http://www.mvps.org/word/FAQs/MacrosVBA/PseudoAutoMacros.htm> How to create global event procedures similar to AutoOpen, AutoNew and AutoClose, without using Normal.dot</A> by Ibby and Dave Rado
    and <A target="_blank" HREF=http://www.mvps.org/word/FAQs/MacrosVBA/ApplicationEvents.htm> Running a macro automatically when Word starts or quits</A> by Dave Rado
    and <A target="_blank" HREF=http://www.mvps.org/word/FAQs/MacrosVBA/AppClassEvents.htm> Writing application event procedures</A>
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: AutoMacros in an addin (Office 2000)

    Thanks to you all.

    I'm a self-taught programmer (yes, it shows at times), and have never used class modules or events before.

Posting Permissions

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