[How To] 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

 

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:

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.

转载于:https://www.cnblogs.com/Magicworks/archive/2010/12/28/1918645.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值