Click to See Complete Forum and Search --> : word document revisions
Suresh_Sajja
Mar 4th, 2006, 12:39 AM
Hai,
I am using VB6.0 and MS word 2000. When I modify the content of the document, I can able to get the altered text(deleted, inserted) from the revisions collection. At the same time, when I modify the text in the tables I am not able to get the altered text. Its giving an error. The error message is 'Requesting object is not availble'. How can I get the altered text in the table?
Thanks in advance.
benbuin
Mar 4th, 2006, 12:28 PM
Can you post the code so we can see where you are getting the error
Suresh_Sajja
Mar 5th, 2006, 11:15 PM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.