Follow hyperlink using the VBA

≯℡__Kan透↙ 提交于 2019-12-13 07:26:05

问题


How to follow hyperlinks in Microsoft Word 2016?

This works fine in Excel:

' Works in Excel
Sub FollowURL()
    ActiveCell.Hyperlinks(1).Follow
End Sub

However, when I try to change ActiveCell to Selection (assuming it is necessary for Word), it doesn't work:

' Doesn't work in Word
Sub FollowURL()
    Selection.Hyperlinks(1).Follow
End Sub

回答1:


What about:

' Note: Ensure the selection contains "http://..."
' for example: http://www.google.com

ActiveDocument.FollowHyperlink Selection.Text

Note: That you check your firewall to let word use this function as @john c. j. mentioned in the comments.



来源:https://stackoverflow.com/questions/45938819/follow-hyperlink-using-the-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!