![]() |
#1
|
|||
|
|||
![]()
Edit: I figured out an answer to this question after a burst of inspiration.
My aim was to make a macro that duplicates a document, runs some editing macros on the new copy, then compares the original file with the new file. I'm doing it this way because having Track Changes on causes problems for the editing macros. The working code is: Code:
Sub Save_Then_Compare() 'Set original document as oDoc Dim oDoc As Word.Document Set oDoc = ActiveDocument 'Save original document ActiveDocument.Save 'Select all text and paste into a new document ActiveDocument.Range.Select ActiveDocument.Range.Copy Documents.Add Selection.Paste 'Save as docx under a new filename ActiveDocument.SaveAs2 Filename:="Output.docx", _ FileFormat:=wdFormatDocumentDefault 'Run editing macros, then save and close the new file EditMacro1 EditMacro2 ActiveDocument.Save ActiveDocument.Close 'Compare the original and revised files and generate the comparison in oDoc oDoc.Compare Name:="Output.docx", _ CompareTarget:=wdCompareTargetCurrent, _ IgnoreAllComparisonWarnings:=False, _ Authorname:="Author" Exit Sub End Sub Chris Last edited by Thefirstfish`; 04-10-2017 at 05:52 PM. Reason: Found a solution |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparison (with styles) Macro | aarona | Word VBA | 0 | 03-03-2017 11:18 PM |
![]() |
BusinessBuilder | Excel | 2 | 08-22-2015 09:17 AM |
![]() |
Fields | Word | 8 | 06-06-2012 05:13 PM |
Saving & reopening comparison | MarshallAbrams | Word | 0 | 03-29-2012 06:19 AM |
Comparison jumps to end | MarshallAbrams | Word | 2 | 03-21-2012 04:04 AM |