Forum Discussion
FireProtection
Feb 11, 2023Copper Contributor
Comparing Documents with Hyperlinks
Hello,
I work in a Code Enforcement role and would like to make an interactive version of the Ontario Fire Code (https://www.ontario.ca/laws/regulation/070213). I would like to include multiple hyperlinks within the document so that if the code says 'go to this standard' or if we have internal documents speaking to a specific code reference our staff can simply click on the hyperlink and a document or folder will open.
The government regularly updates the code and I don't want to have to re-do this each time there is a code update. I would also like to try and avoid having to manually cut and paste all of the revisions into the word document.
In the test runs I have done the compare document seems to flag my hyperlinks and then remove the links. Is there a way to use the 'compare document' function to create an updated document without losing all of the hyperlinks?
8 Replies
Sort By
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.
- FireProtectionCopper 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.
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