How To Use A Macro To Combine These Comments Into A File?
Dec 28 2011, 08:44 PM
I have a directory which has several copies of the same word document. A different person has added comments in each copy and how to use a macro to combine these comments into one file. Essentially, repeat the command 'Compare and merge documents' legal blackline a number of times..
Could anyone help please? thanks in advance.
Jan 3 2012, 09:54 AM
Here's a fairly simple macro that should get you well on your way:
' CombineFolderOfFiles Macro
' Close all open documents before beginning
strFolder = "H:\Data Files\"
' Create a new, blank file to copy all of the contents into
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
' Add a short header describing which folder the file summary is for
Selection.Text = "Combination of files from folder: " & strFolder & vbCrLf
' Get the first filename
myFile = Dir(strFolder & "*.doc*")
While myFile <> ""
' Open document
Set myDoc = Documents.Open(strFolder & myFile)
' Selection.HomeKey Unit:=wdStory
' Copy the entire file's contents...
' Close the file
' Paste the file contents into the new file
' Get the next filename
myFile = Dir()
Remember to change the strFolder = "H:\Data Files\" bit to the appropriate folder name.
Hope this helps,
|Go to Top · Lo-Fi Version||Time is now: 18th May 2013 - 09:32 PM|