View Single Post
  #1   IP: 218.2.66.178
Old 2007-09-04, 05:14 PM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default Remove All Hyperlinks in Word or Excel

These two nifty macros enable you to delete the embedded hyperlinks that are generated when typing URLS or copying information from the web.
Ever copy and paste something from the Internet and then into Word only to get the hyperlinks embedded? You can removed them easily with the Macros below.


Word

Hit [ALT]+[F11] to open the Visual Basic Editor

Go to "Insert" > "Module" and in the pop-up window copy:
Quote:
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


Then click "File" > Close and return to Microsoft Word

You can now run the Macro in Word by going to:

Tools > Macro > Macro and then Run "RemoveAllHyperlinks"

Excel:

You can do the same in an Excel Document:

Hit [ALT]+[F11] to open the Visual Basic Editor

Go to "Insert" > "Module" and in the pop-up window copy:



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


Then click "File" > Close and return to Microsoft Excel

You can now run the Macro in Excel by going to:

Tools > Macro > Macro and then Run "RemoveAllHyperlinks", this will delete all URLS on the selected worksheet.

Last edited by topvip : 2008-05-06 at 03:42 PM