Re: word document revisions
Can you post the code so we can see where you are getting the error
Re: word document revisions
Private Sub cmdLog_Click()
Set WApp = New Word.Application
Set WDoc = WApp.Documents.Open(App.Path & "\test.doc")
' Trace The Track Changes
WDoc.TrackRevisions = True
' Hide the Track Changes in the Document
WDoc.ShowRevisions = False
WApp.Visible = True
End Sub
Private Sub WApp_DocumentBeforeClose(ByVal Doc As Word.Document, Cancel As Boolean)
Call GetTrackChanges(Doc)
Doc.ShowRevisions = False
WDoc.TrackRevisions = False
Doc.ActiveWindow.View.ShowHighlight = False
' To Clear the Revisions by accepting changes
Doc.Revisions.AcceptAll
WDoc.Save
WDoc.Close
WApp.Quit
Set WDoc = Nothing
Set WApp = Nothing
End Sub
Public Sub GetTrackChanges(ByRef WDocPrint As Document)
Dim intCnt As Integer
WDocPrint.ShowRevisions = True
For intCnt = 1 To WDocPrint.Revisions.Count
MsgBox "Start Position : " & WDocPrint.Revisions(intCnt).Range.Start
MsgBox "Text : " & WDocPrint.Revisions(intCnt).Range.Text
Next intCnt
WDocPrint.ShowRevisions = False
End Sub
Its working fine if we alter the content. But the problem arises if we alter the table content. Its giving the error while executing the
MsgBox "Start Position : " & WDocPrint.Revisions(intCnt).Range.Start
statement.