Tuesday, July 13, 2010

How to Remove All Hyperlinks in Word or Excel

Here's the step by step how to remove all hyperlinks in your excel or Word file:

1. Open the word/ excel file
2. Hit [Alt]+[F11] to open the Visual Basic Editor
3. Go to menu [Insert]>[Module]
4. Copy and paste the code below:

Ms. Word:
Sub RemoveHyperlinks()
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing
End Sub

Ms. Excel:
Sub RemoveHyperlinks()
'Remove all hyperlinks from the active sheet
ActiveSheet.Hyperlinks.Delete
End Sub

5. And then click [File]>[Close]
6. On Word/Excel file go to [View]>[Macros]>[View Macros]
7. Run “RemoveAllHyperlinks”
8. Now all hyperlinks are removed successfully

Note: I'm using Office 2007

No comments: