![]() |
#1
|
|||
|
|||
![]()
I have a macro that cleans up a Word document, doing things like changing line breaks to paragraph marks, changing curly quotes to regular ones, changing double hyphens to an em-dash, and the like. If the document comes in with Track Changes on, and I execute the macro without turning that function off, it goes into an endless loop and crashes Word.
Is there a way to have the macro begin with a command to check if Track Changes is on and, if yes, to turn it off? Thanks for any help. |
#2
|
||||
|
||||
![]()
Yes, that can be done, but even that might not be sufficient. Typically, a Find/Replace macro, for instance, needs to be coded so it processes the document backwards. That is typically achieved by changing:
.Forward = True and, if your code uses it .Collapse wdCollapseEnd to: .Forward = False and .Collapse wdCollapseStart respectively.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]() Code:
Dim bTrackChanges As Boolean Let bTrackChanges = ActiveDocument.TrackRevisions Let ActiveDocument.TrackRevisions = False ' Your code here Let ActiveDocument.TrackRevisions = bTrackChanges Note that often a password is needed to turn off track changes. |
#4
|
|||
|
|||
![]()
Many thanks, Charles. That certainly works. I discovered the proper wording for Track Changes, and starting the macro with this also works:
ActiveDocument.TrackRevisions = False |
#5
|
||||
|
||||
![]()
Do note that switching Tack Changes off means the changes made by your macro won't be tracked.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Tags |
macro, track changes |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
BABZ | Word VBA | 1 | 01-09-2017 10:33 PM |
Spell check macro within macro button field doesn't work in one document | samuelle | Word VBA | 0 | 07-20-2016 02:27 AM |
![]() |
Thefirstfish` | Word VBA | 13 | 01-09-2016 07:14 AM |
![]() |
BIMwit | Excel Programming | 6 | 06-13-2015 12:04 PM |
![]() |
Johnny thunder | Word VBA | 12 | 04-07-2011 04:47 PM |