PC Review


Reply
Thread Tools Rate Thread

Accept all track changes on a group of documents

 
 
JR
Guest
Posts: n/a
 
      26th Oct 2007
I have about 50,000 documents that I want to accept any changes in
them and remove any comments from the document. Any kind of macro or
something that can do this bulk on aoo documents in a folder?

Thanks.

JR

 
Reply With Quote
 
 
 
 
Graham Mayor
Guest
Posts: n/a
 
      26th Oct 2007
JR wrote:
> I have about 50,000 documents that I want to accept any changes in
> them and remove any comments from the document. Any kind of macro or
> something that can do this bulk on aoo documents in a folder?
>
> Thanks.
>
> JR


The basic code for batch processing the contents of a folder is as follows.
The example shown will accept all changes in the documents and remove
comments. http://www.gmayor.com/installing_macro.htm

50,000 is a hell of a lot of documents for a single folder? It would be
better to split this into more manageable chunks. Either way it is going to
take some time to run, so test on a subset to ensure that it does what you
want.

Sub BatchProcessings()
Dim myFile As String
Dim PathToUse As String
Dim MyDoc As Document
Dim iFld As Integer

'Select the folder top process
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
'Close and prompt to save any open documents
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
myFile = Dir$(PathToUse & "*.do?")
While myFile <> ""
Set MyDoc = Documents.Open(PathToUse & myFile)
'**********************************************
'Apply the code in this section to each document
With WordBasic
.AcceptAllChangesInDoc
.DeleteAllCommentsInDoc
End With
'**********************************************
'Save and close the document and open the next
MyDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub


 
Reply With Quote
 
JR
Guest
Posts: n/a
 
      29th Oct 2007
On Oct 26, 12:14 am, "Graham Mayor" <gma...@REMOVETHISmvps.org> wrote:
> JR wrote:
> > I have about 50,000 documents that I want to accept any changes in
> > them and remove any comments from the document. Any kind of macro or
> > something that can do this bulk on aoo documents in a folder?

>
> > Thanks.

>
> > JR

>
> The basic code for batch processing the contents of a folder is as follows.
> The example shown will accept all changes in the documents and remove
> comments.http://www.gmayor.com/installing_macro.htm
>
> 50,000 is a hell of a lot of documents for a single folder? It would be
> better to split this into more manageable chunks. Either way it is going to
> take some time to run, so test on a subset to ensure that it does what you
> want.
>
> Sub BatchProcessings()
> Dim myFile As String
> Dim PathToUse As String
> Dim MyDoc As Document
> Dim iFld As Integer
>
> 'Select the folder top process
> With Dialogs(wdDialogCopyFile)
> If .Display <> 0 Then
> PathToUse = .Directory
> Else
> MsgBox "Cancelled by User"
> Exit Sub
> End If
> End With
> 'Close and prompt to save any open documents
> If Documents.Count > 0 Then
> Documents.Close SaveChanges:=wdPromptToSaveChanges
> End If
> If Left(PathToUse, 1) = Chr(34) Then
> PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
> End If
> myFile = Dir$(PathToUse & "*.do?")
> While myFile <> ""
> Set MyDoc = Documents.Open(PathToUse & myFile)
> '**********************************************
> 'Apply the code in this section to each document
> With WordBasic
> .AcceptAllChangesInDoc
> .DeleteAllCommentsInDoc
> End With
> '**********************************************
> 'Save and close the document and open the next
> MyDoc.Close SaveChanges:=wdSaveChanges
> myFile = Dir$()
> Wend
> End Sub


This is great. Thanks for the help. Didn't realize there was a
WordBasic function called DeleteAllCommentsInDoc. Wish the WordBasic
stuff was documented somewhere. Doesn't seem to be a lot of info on
it. Yahoo comes up with like three hits if you search on WordBasic
and DeleteAllCommentsInDoc.

Is there something similar if you want to remove all Macros in a
document as well regardless of what it is?

Thanks.

JR

 
Reply With Quote
 
JR
Guest
Posts: n/a
 
      30th Oct 2007
On Oct 26, 12:14 am, "Graham Mayor" <gma...@REMOVETHISmvps.org> wrote:
> JR wrote:
> > I have about 50,000 documents that I want to accept any changes in
> > them and remove any comments from the document. Any kind of macro or
> > something that can do this bulk on aoo documents in a folder?

>
> > Thanks.

>
> > JR

>
> The basic code for batch processing the contents of a folder is as follows.
> The example shown will accept all changes in the documents and remove
> comments.http://www.gmayor.com/installing_macro.htm
>
> 50,000 is a hell of a lot of documents for a single folder? It would be
> better to split this into more manageable chunks. Either way it is going to
> take some time to run, so test on a subset to ensure that it does what you
> want.
>
> Sub BatchProcessings()
> Dim myFile As String
> Dim PathToUse As String
> Dim MyDoc As Document
> Dim iFld As Integer
>
> 'Select the folder top process
> With Dialogs(wdDialogCopyFile)
> If .Display <> 0 Then
> PathToUse = .Directory
> Else
> MsgBox "Cancelled by User"
> Exit Sub
> End If
> End With
> 'Close and prompt to save any open documents
> If Documents.Count > 0 Then
> Documents.Close SaveChanges:=wdPromptToSaveChanges
> End If
> If Left(PathToUse, 1) = Chr(34) Then
> PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
> End If
> myFile = Dir$(PathToUse & "*.do?")
> While myFile <> ""
> Set MyDoc = Documents.Open(PathToUse & myFile)
> '**********************************************
> 'Apply the code in this section to each document
> With WordBasic
> .AcceptAllChangesInDoc
> .DeleteAllCommentsInDoc
> End With
> '**********************************************
> 'Save and close the document and open the next
> MyDoc.Close SaveChanges:=wdSaveChanges
> myFile = Dir$()
> Wend
> End Sub


By the way, the code is erroring on the .DeleteAllCommentsInDoc
command. Get a runtime error 509. This command is not available.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Track/Accept Changes =?Utf-8?B?V2hPa05vV3M=?= Microsoft Excel Worksheet Functions 0 22nd Aug 2007 02:26 PM
Can I accept all changes in Track Changes just once? =?Utf-8?B?V2lsZWxt?= Microsoft Word Document Management 1 4th Aug 2006 10:45 PM
Accept All Changes in Track Changes got confused =?Utf-8?B?QWxlc2lhIFNpcGVz?= Microsoft Word Document Management 0 9th Feb 2006 06:04 PM
track changes - accept and next =?Utf-8?B?Y29va3Rq?= Microsoft Word Document Management 2 10th Oct 2005 07:37 PM
Cannot accept and/or turn off Track Changes =?Utf-8?B?RG9ybmEgVHVja2Vy?= Microsoft Word Document Management 1 9th Aug 2004 05:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:32 PM.