how to edit Word 2010 document without running macro

Posted on 2012-09-11
Last Modified: 2012-09-12
I have the macro shown below in a Word 2010 document. I have enabled the macro and marked the document as "trusted". Now, I need to edit the document, but whenever I open the doc, it runs the macro. You will notice that the line 15 of the macro is 'docMain.Close wdDoNotSaveChanges', so it closes the main document and is therefore no longer avaiable in Word. I've googled all over and can't seem to find a way to open the document in edit mode without running the maco. Need help!

Option Explicit

Private Sub Document_Open()
End Sub

Public Sub DoMailMerge()
    Dim docMain As Document
    Set docMain = ThisDocument
    With ActiveDocument.MailMerge
        .Destination = wdSendToNewDocument
    End With
    docMain.Close wdDoNotSaveChanges
End Sub

Open in new window

Question by:jmarkfoley
    LVL 5

    Assisted Solution

    To prevent Word from loading the macros type winword /m and hit Enter
    LVL 10

    Accepted Solution

    You can move the document to a non-trusted location, edit the macro, and then move it back to the trusted location.
    LVL 1

    Author Comment

    tdlewis: Your suggestion seems rather brute-force, but it worked and is easy. I moved the document to another folder; opened it; got the yellow "enable macros" banner; did not enable the macro; and was able to edit my document. When I moved it back I got the warning again and did enable macros. It then worked fine.

    albelo: I assume you meant to enter that command in Start > search, then File > Open ...
    I tried that and it worked too, but tdlewis' move to different folder method is simpler for a clerical user to perform, so I chose that solution.

    I give cudos to microsoft for inventing the "trusted document" idea which is a great improvement over the Word 2003 method of either reducing security or obtaining a certificate, but I take away cudos for not providing a straightforward way to NOT execute macros (like, for example, right-click on the document and have an option to "Open without executing macros").

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
    A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
    This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
    Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now