Forum Discussion
Comparing Documents with Hyperlinks
FireProtection If you use the Compare facility to compare your document with the Hyperlinks with the revised document selecting for the changes to be shown in the revised document, your Hyperlinks will be marked as deleted text and you can right click on each one and then reject the deletion which will reinstate the Hyperlink in the copy of the revised document created by the Compare facility.
- FireProtectionFeb 12, 2023Copper Contributor
Doug_Robbins_Word_MVP Doug, really appreciate the reply. I did explore that option during my testing. The issue doing it that way will be that I may have 300-500 hyperlinks or possibly more in the future. If there is a 300-500 item code change I will now have to manually go through hundreds of items while trying to not delete out existing hyperlinks. That is why I was hoping to find a way to have the documents compared without the hyperlinks being included as changes.
- Feb 12, 2023
FireProtection Running a macro containing the following code on the document created by the Compare function that I suggested, will result in the rejection of the deletion of any hyperlinks in that document with affecting any of the other revisions, which you could then accept to end up with a document free of revisions.
Dim arev As Revision Dim i As Long With ActiveDocument For Each arev In .Revisions If arev.Type = wdRevisionDelete Then If arev.Range.Fields.Count > 0 Then For i = arev.Range.Fields.Count To 1 Step -1 If arev.Range.Fields(i).Type = wdFieldHyperlink Then arev.Reject End If Next i End If End If Next arev End With
- FireProtectionFeb 13, 2023Copper Contributor
Doug_Robbins_Word_MVP This Macro almost does exactly what I was trying to accomplish. It does create one small issue. It double's up the text. I had made the entire standard name the hyperlinked text. The below snip is from the compared document, you can see it doubled up the text. The first version still has the hyperlink, the second does not and is redundant.