Results 1 to 15 of 15
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Macro not firing on open

    MSO 2010 win 7

    Hi

    I have created a document to merge client informatio from our SQL database, works fine. The document also has a dialogue that pops up requestuing additional information for input into the communication. The document has been saved a dotm file and works fine for me. Anybody else that trys to use the document only gets the client information. The attached macro fails to fire

    I have searched all through the Word options but cannot find anything that should prevent the macro from firing.

    Anyone have any clues as to why this should happen?
    cheers

    Phil Carter

  2. #2
    New Lounger
    Join Date
    Feb 2012
    Location
    St. Louis, MO
    Posts
    21
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Are the users enabling macros and content?

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    Thanks for replying

    By default all our computers are set to "Enable all macros" in the Trust Center and under Tristed Documents we have "Allow all documents on a network to be trusted" checked.

    We have very strong security on our networks to ensure all the bad stuff is kept out
    cheers

    Phil Carter

  4. #4
    New Lounger
    Join Date
    Feb 2012
    Location
    St. Louis, MO
    Posts
    21
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Are the other users getting any type of error when the document opens?

    Could you please attach a copy of the document.

    Thanks!

  5. #5
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    No errors

    Dotm file attached
    Attached Files Attached Files
    cheers

    Phil Carter

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Try renaming the macro that is meant to fire. AutoOpen fires when a document is opened - apparently not when a new document is created from a template.

    This macro looks like it should be named AutoNew rather than AutoOpen.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    Andrew a good point.

    What I don't understand is why it works for me and no one else!
    cheers

    Phil Carter

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Are you opening the template or creating new documents with it? I expect the others are double-clicking and creating new docs but you might be opening the template instead.

    On the other machines where the macro doesn't run, can you open the VB Editor and manually run the macro after the document is opened? Or is this actually disabled by the macro protection.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #9
    New Lounger
    Join Date
    Feb 2012
    Location
    St. Louis, MO
    Posts
    21
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Have you tried placing the VBA code under in the Document OnOpen Event instead?

  10. #10
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts
    bonriki,

    Is it possible you have a reference set to a library on your computer that isn't installed on the others?

    Regarding the AutoRun... When I want a template to run a macro and display a dialog when a document is newly created from it, I put code into the ThisDocument module and use the Document_New event, like so:

    Code:
     Sub Document_New()
      modDoStuff.StartDialog
    End Sub
    This launches StartDialog in the module modDoStuff, when the document is created for the first time. I started doing it this when WordBasic made way for VBA, and I read multiple accounts of how the Auto___ named routines were sometimes unreliable. I don't know if they actually are, but the Document Events have never failed me.

    You can add Document_Open, Document_Close, and other events to capture and do stuff when they happen.

    Best, Kim

  11. #11
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    Kim

    Thanks for that. I'll give it a try
    cheers

    Phil Carter

  12. #12
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Andrew Lockton View Post
    Are you opening the template or creating new documents with it? I expect the others are double-clicking and creating new docs but you might be opening the template instead.

    On the other machines where the macro doesn't run, can you open the VB Editor and manually run the macro after the document is opened? Or is this actually disabled by the macro protection.
    Andrew

    The document is a Word merge doc that is opened from within our client SQL database with the dialogue allowing the input of additional variable information.

    All the m/cs are set to allow all macros to run. We have very robust virus checking in place
    cheers

    Phil Carter

  13. #13
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Then that sounds like the other users don't have access to the attached template (which is where the macro is located).

    If this is what is happening then...
    You have the attached template sitting in your templates folder so when you create a new document, it finds the attached template and is able to run the code. Other users are accessing an existing document but don't have access to the attached template.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  14. #14
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    Andrew hi

    Not sure I follow.

    If they select the *.dotm file, which has the macro attached, surely they have access to the template.
    cheers

    Phil Carter

  15. #15
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    You said "
    The document is a Word merge doc that is opened from within our client SQL database".

    Try renaming the template in your template folder and then try opening the "Word merge doc within your client SQL database". Does it run the macro? Does it have an attached template? Can you go to that attached template and verify that the template exists?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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