1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Why is Word running a macro on startup?

Discussion in 'Business Applications' started by highlysceptical, May 7, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    I have an installation of Word where every time I start the program, it runs a macro.

    The macro performs a mail merge using a .csv datasource and after running the macro, the .csv file remains locked until I close all open word documents (not just the one(s) associated with the mail merge).

    After this occurs, the macro then runs every time I open Word, even though it is not in the normal.dot template and it is not called autoexec!

    Can anyone tell me what is going on?
     
  2. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    67,499
    is this a business machine or a home pc?

    Can you upload a copy of the sheet please?
     
  3. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    thanks for the reply.

    The pc is both really - business and home.

    I don't understand what you are asking me to do. What do you mean by upload a copy of the sheet?
     
  4. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    67,499
    just open word, and save the page it opens as something, then attach it here....

    Also, is it a .docx format, or .docm? You can probably stop that from happening just by making your starting default page .docx.
     
  5. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    Thanks for the clarification.

    I have attached a screenshot showing the warning, and the document created once I click "Yes"

    As for the opening document format, I wasn't aware that I had set / chosen one. As I mentioned initially, this problem only occurs after running the macro which uses the "word invoice.csv" datasource referred to on the warning. And I really need to get to the bottom of why running that macro is locking the datasource file until I close all documents in Word, because at the moment, it is extremely annoying trying merge a document, create a new datasource file, merge the document, create the datasource etc.
     

    Attached Files:

  6. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    67,499
    worked fine for me here........it's something on your side.......let me call in a business app expert, be patient.

    thanks,

    v
     
  7. WendyM

    WendyM Trusted Advisor

    Joined:
    Jun 27, 2003
    Messages:
    4,032
    Based on your screenshot and description, it's not running a macro, it's trying to run a mail merge. When you open Word, are all of your mail merge options available to select (see attached screenshot)? If so, drop down the mail merge arrow and choose Normal Word Document. That should remove the data sources from the document. Save the document and reopen it. Any difference?
     

    Attached Files:

  8. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    67,499
    Thanks, WendyM. :)
     
  9. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    I assumed that it was running the macro that I use to perform the mail merge.

    I have tried opening Word choosing both Yes and No from the security warning dialog. In both cases, most of the mail merge menu options are not available. I can, however, drop down the Start Mail Merge menu and select Normal Word Document, but this does not help. Next time I open Word, I am back to the same situation.

    But I come back to the point that this is a problem that has manifest itself across our network, and the root problem seems to be that when we run the macro that performs the mail merge, it doesn't release / free the datasource, so we then cannot overwrite the datasource file (the .csv file) until we have closed all the documents open in Word. So I am assuming that the fundamental error is in the macro (of which I posted what I thought was the relevant section).
     
  10. WendyM

    WendyM Trusted Advisor

    Joined:
    Jun 27, 2003
    Messages:
    4,032
    The macro warning you attached is not a warning and it has nothing to do with macros. The message you see will appear for any document with a mail merge source attached to it. It's simply asking whether you want data from the data source included in your document. In order to be running a macro, the document would have to be named .docm instead of .docx.

    My best guess is that the macro you run is attaching the data source to all documents, which is why you see that message when you open any document and why it does not release the .csv file.

    Can you attach the code for your macro? Unless I overlooked it, you haven't posted any of the macro itself, just the mail merge message and a blank document. Thanks.
     
  11. Garf13LD

    Garf13LD

    Joined:
    Apr 17, 2012
    Messages:
    455
  12. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    Thank you very much for taking the trouble to help me with this. I have no doubt I am overlooking something obvious, but I just cannot work out what!

    I have attached the entire macro as requested.
     

    Attached Files:

  13. WendyM

    WendyM Trusted Advisor

    Joined:
    Jun 27, 2003
    Messages:
    4,032
    I haven't had a chance to study the macro yet, but you might want to give Garf's solution of deleting normal.dotx a try. Then open a document and see if it still prompts you about the mail merge. If not, run your macro again and then open another document. If it gives you the prompt again, that will confirm that the macro is adding the data source to the normal template.
     
  14. highlysceptical

    highlysceptical Thread Starter

    Joined:
    Oct 5, 2009
    Messages:
    11
    Thanks for the suggestions. However, they have not solved the problem. I closed Word, deleted the normal.dotm file and reopened Word, and the prompt was still there!

    I also checked in Word that I was deleting the file from the correct template folder, and I was. So on opening Word, there was no file in the folder. But as soon as I closed Word, a new normal.dotm file appeared.
     
  15. Garf13LD

    Garf13LD

    Joined:
    Apr 17, 2012
    Messages:
    455
    The article is not about deleting normal.dot.
    It talks about issuing a command called mailmergereset.
    As your mail merge some how gets into your template, you need to "unmerge" it.
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1052306