(Msg. 1) Posted: Thu Oct 25, 2007 7:18 pm
Post subject: Accept all track changes on a group of documents Archived from groups: microsoft>public>word>docmanagement (more info?)
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?
(Msg. 2) Posted: Fri Oct 26, 2007 3:02 am
Post subject: Re: Accept all track changes on a group of documents [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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
(Msg. 3) Posted: Mon Oct 29, 2007 7:28 am
Post subject: Re: Accept all track changes on a group of documents [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Oct 26, 12:14 am, "Graham Mayor" <gma....TakeThisOut@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?
(Msg. 4) Posted: Tue Oct 30, 2007 6:59 am
Post subject: Re: Accept all track changes on a group of documents [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Oct 26, 12:14 am, "Graham Mayor" <gma....DeleteThis@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.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum