【问题标题】:Is there any method equivalent for "FollowHyperlink" in Outlook VBA?Outlook VBA中是否有与“FollowHyperlink”等效的方法?
【发布时间】:2018-04-18 01:27:45
【问题描述】:

Outlook VBA 中是否有与 Excel 的 FollowHyperlink 等效的方法?

我制作了一个 Excel VBA 宏,它使用 FollowHyperlink 方法将剪贴板中的文本发布到特定站点。

我想用 Outlook VBA 做同样的事情,但我找不到方法。

任何与FollowHyperlink 做同样事情的方法都很好。

这是一个 Excel VBA 版本的函数,它将剪贴板的内容发布到谷歌翻译。我想制作这个的 Outlook 版本。

Public Sub GoogleTranslate_2EN()
    Dim clipBoard As New DataObject
    With clipBoard
    On Error Resume Next
        .GetFromClipboard
        Dim targetText As String
        targetText = .GetText
    On Error GoTo 0
    End With

    Dim URL As String
    URL = "https://translate.google.co.jp/?hl=en&tab=wT#auto/en/" & targetText

    ThisWorkbook.FollowHyperlink Address:=URL, newWindow:=False, AddHistory:=True
End Sub

【问题讨论】:

  • 发布您当前的代码,我们也许可以将其修改为 Outlook vba
  • 我尝试使用 shell 作为文章“使用 VBA 在默认浏览器中打开 html 页面?”中的代码。使用 shell 不会像 FollowHyperlink 那样进行 HTML 编码。

标签: vba outlook


【解决方案1】:

我决定使用 Word.Application 对象并使用 Word 对象中的“FollowHyperlink”。成功了!

现在,我可以在收到德国的电子邮件后立即通过 Google 将其翻译成英语。 :-)

Public Sub ClipboardGoogleTranslate_2EN()

    Dim wdApp As Word.Application

    Set wdApp = CreateObject("Word.Application")

    wdApp.Run "ClipboardGoogleTranslate_2EN"

    wdApp.Quit

    Set wdApp = Nothing

End Sub

【讨论】:

    猜你喜欢
    • 2012-03-29
    • 1970-01-01
    • 1970-01-01
    • 2017-11-09
    • 2017-10-23
    • 2012-03-17
    • 2013-06-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多