Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to edit Word 2010 document without running macro

Posted on 2012-09-11
3
Medium Priority
?
557 Views
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()
DoMailMerge
End Sub

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

Open in new window

0
Comment
Question by:jmarkfoley
3 Comments
 
LVL 5

Assisted Solution

by:albelo
albelo earned 600 total points
ID: 38388390
To prevent Word from loading the macros type winword /m and hit Enter
0
 
LVL 10

Accepted Solution

by:
tdlewis earned 1400 total points
ID: 38388480
You can move the document to a non-trusted location, edit the macro, and then move it back to the trusted location.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 38393471
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").
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

580 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