A
avarghese
Hi
I have a function to "highlight changes" between the currently open document and another document that is stored on a remote fileserver. This is what my code does
Function HighlightChanges(strCompareDoc As String) As Boolea
'*********************************************************************************
'*Purpose: Highlight changes from Prior Draft/Report. This is different from word's defaul
'* behavior during Document Compare. First, it allows for highlighting the changes
'* Second, it removes all place holders for deleted text/tables. Third, after th
'* changes accepted, the highlighting remains
'*Parameters: strCompareDoc (STRING) : Document to Compare ActiveDocument to
'*Return: True - Changes Highlighted False- Error Highlightin
'*Note: Word has issues comparing docs with fields greater than 750 chars in length and wil
'* notify user of this issue. This notice does not effect highlighting except that thos
'* fields are not compared. The field usually is Table of Contents or Index. Use
'* simply needs to click OK
'*********************************************************************************
'*****Declare Variables****
Dim lngI As Long 'Loop Counte
Dim lngRevCount As Long 'Count of Revision
On Error GoTo Error_Handle
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorWai
'*****Turn off screen updating****
Application.ScreenUpdating = Fals
On Error Resume Nex
ActiveDocument.Compare strCompareDo
'*****Reset Error Trapping****
On Error GoTo
On Error GoTo Error_Handle
'*****Set Compare Document Options****
With Option
.InsertedTextMark = wdInsertedTextMarkNon
.InsertedTextColor = wdByAutho
.DeletedTextMark = wdDeletedTextMarkHidde
.DeletedTextColor = wdByAutho
.RevisedPropertiesMark = wdRevisedPropertiesMarkNon
.RevisedPropertiesColor = wdAut
.RevisedLinesMark = wdRevisedLinesMarkNon
.RevisedLinesColor = wdAut
End Wit
'*****Count of Revisions****
lngRevCount = ActiveDocument.Revisions.Coun
'*****Loop through Revisions and Highlight them****
For lngI = 1 To lngRevCoun
ActiveDocument.Revisions(lngI).Range.Selec
Selection.Range.HighlightColorIndex = wdYello
Nex
'*****Accept all revisions****
ActiveDocument.Revisions.AcceptAl
'*****Return True****
HighlightChanges = Tru
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorNorma
Exit_Point
Exit Functio
Error_Handler
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorNorma
HighlightChanges = Fals
Resume Exit_Poin
End Functio
I am not sure where the problem occurs but this piece of code does not work on Windows XP. Currently it is working on Window 2000. I suspect the following line of code is causing the problem
'*****Loop through Revisions and Highlight them****
For lngI = 1 To lngRevCoun
ActiveDocument.Revisions(lngI).Range.Selec
Selection.Range.HighlightColorIndex = wdYello
Nex
but I am not sure.
Please let me know if you have any suggestions. Also let me know if there is a way to detect the version of the Operating System from VBA
I really appreciate any help
Thank
Ale
I have a function to "highlight changes" between the currently open document and another document that is stored on a remote fileserver. This is what my code does
Function HighlightChanges(strCompareDoc As String) As Boolea
'*********************************************************************************
'*Purpose: Highlight changes from Prior Draft/Report. This is different from word's defaul
'* behavior during Document Compare. First, it allows for highlighting the changes
'* Second, it removes all place holders for deleted text/tables. Third, after th
'* changes accepted, the highlighting remains
'*Parameters: strCompareDoc (STRING) : Document to Compare ActiveDocument to
'*Return: True - Changes Highlighted False- Error Highlightin
'*Note: Word has issues comparing docs with fields greater than 750 chars in length and wil
'* notify user of this issue. This notice does not effect highlighting except that thos
'* fields are not compared. The field usually is Table of Contents or Index. Use
'* simply needs to click OK
'*********************************************************************************
'*****Declare Variables****
Dim lngI As Long 'Loop Counte
Dim lngRevCount As Long 'Count of Revision
On Error GoTo Error_Handle
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorWai
'*****Turn off screen updating****
Application.ScreenUpdating = Fals
On Error Resume Nex
ActiveDocument.Compare strCompareDo
'*****Reset Error Trapping****
On Error GoTo
On Error GoTo Error_Handle
'*****Set Compare Document Options****
With Option
.InsertedTextMark = wdInsertedTextMarkNon
.InsertedTextColor = wdByAutho
.DeletedTextMark = wdDeletedTextMarkHidde
.DeletedTextColor = wdByAutho
.RevisedPropertiesMark = wdRevisedPropertiesMarkNon
.RevisedPropertiesColor = wdAut
.RevisedLinesMark = wdRevisedLinesMarkNon
.RevisedLinesColor = wdAut
End Wit
'*****Count of Revisions****
lngRevCount = ActiveDocument.Revisions.Coun
'*****Loop through Revisions and Highlight them****
For lngI = 1 To lngRevCoun
ActiveDocument.Revisions(lngI).Range.Selec
Selection.Range.HighlightColorIndex = wdYello
Nex
'*****Accept all revisions****
ActiveDocument.Revisions.AcceptAl
'*****Return True****
HighlightChanges = Tru
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorNorma
Exit_Point
Exit Functio
Error_Handler
'*****Set Mouse Pointer back to normal****
System.Cursor = wdCursorNorma
HighlightChanges = Fals
Resume Exit_Poin
End Functio
I am not sure where the problem occurs but this piece of code does not work on Windows XP. Currently it is working on Window 2000. I suspect the following line of code is causing the problem
'*****Loop through Revisions and Highlight them****
For lngI = 1 To lngRevCoun
ActiveDocument.Revisions(lngI).Range.Selec
Selection.Range.HighlightColorIndex = wdYello
Nex
but I am not sure.
Please let me know if you have any suggestions. Also let me know if there is a way to detect the version of the Operating System from VBA
I really appreciate any help
Thank
Ale