使用VBA跟随超链接 [英] Follow hyperlink using the VBA

查看:115
本文介绍了使用VBA跟随超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Microsoft Word 2016中跟踪超链接?

How to follow hyperlinks in Microsoft Word 2016?

这在Excel中正常工作:

This works fine in Excel:

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

但是,当我尝试将ActiveCell更改为Selection时(假定对于Word来说是必需的),它不起作用:

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

推荐答案

有关:

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

ActiveDocument.FollowHyperlink Selection.Text

注意:您检查防火墙以让word将此功能用作@john c. j.在评论中提到.

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

这篇关于使用VBA跟随超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆