• Macro not firing on open

    Author
    Topic
    #482318

    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?

    Viewing 6 reply threads
    Author
    Replies
    • #1326075

      Are the users enabling macros and content?

      • #1326089

        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

        • #1326226

          Are the other users getting any type of error when the document opens?

          Could you please attach a copy of the document.

          Thanks!

    • #1326494

      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.

      • #1326496

        Andrew a good point.

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

    • #1326518

      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.

      • #1326674

        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

    • #1326537

      Have you tried placing the VBA code under in the Document OnOpen Event instead?

    • #1326648

      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

    • #1326677

      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.

      • #1326680

        Andrew hi

        Not sure I follow.

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

    • #1326685

      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?

    Viewing 6 reply threads
    Reply To: Macro not firing on open

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

    Your information: