0

Is there any method in Outlook VBA equivalent to Excel's FollowHyperlink?

I made an Excel VBA macro that posts the text in the clipboard to a specific site using FollowHyperlink method.

I want to do the same thing with Outlook VBA but I couldn't find the method.

Any method that does the same thing as simply as FollowHyperlink is quite fine.

Here is the Excel VBA version of a function that post the content of the clipboard to Google translation. I want to make an Outlook version of this one.

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
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

I've decided to use Word.Application object and use "FollowHyperlink" from a Word object. It worked!

Now I can Google translate emails in Germany to English as soon as I receive them. :-)

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