+ Reply to Thread
Results 1 to 2 of 2

Outlook - FollowHyperlink method not working

Hybrid View

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    1

    Outlook - FollowHyperlink method not working

    Hi all,

    I have the following Excel macro which uses the FollowHyperlink method to open any saved document (.msg, .pdf, .xlsm files etc). The file names are listed in column J and the file paths in column K. This code works fine:

        Dim myFileName As String
        Dim myFilePath As String
    
        myFileName = Sheets("Directory 1").Range("J" & ActiveCell.Row).Value
        myFilePath = Sheets("Directory 1").Range("K" & ActiveCell.Row).Value
        
        FullName = myFilePath & "\" & myFileName
    
        ActiveWorkbook.FollowHyperlink FullName
    What I am trying to do is replicate this macro in Outlook VBA to open documents saved to the drive based on file names and file paths listed in a multi-column ListBox. The file names are listed in the 10th column of the ListBox and the file paths in the 11th. I tried to replicate the Excel VBA code, with modifications as per below, but it doesn't work.

        Dim myFileName As String
        Dim myFilePath As String
    
        myFileName = ListBox1.List(ListBox1.ListIndex, 9)
        myFilePath = ListBox1.List(ListBox1.ListIndex, 10)
        
        FullName = myFilePath & "\" & myFileName
    
        Application.FollowHyperlink FullName
    Any ideas would be much appreciated.

    Many thanks

  2. #2
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: Outlook - FollowHyperlink method not working

    There is no FollowHyperlink in Outlook VBA. See here for what is available for the Application object.

    https://msdn.microsoft.com/en-us/lib...ffice.14).aspx

    Sub WordEditor_FollowHyperlink()
    
    ' Set a reference to the Word object library
    Dim msg As mailItem
    Dim oDoc As Word.Document
    Dim FullName As String
    
    Set msg = CreateItem(0)
    
    If msg.GetInspector.EditorType = olEditorWord Then
        Set oDoc = msg.GetInspector.WordEditor
        FullName = "c:\test\test.docx"
        ' https://msdn.microsoft.com/en-us/library/office/ff840237(v=office.14).aspx
        oDoc.FollowHyperlink FullName
    End If
    
    ExitRoutine:
        Set msg = Nothing
        Set oDoc = Nothing
    
    End Sub
    To mark "Solved" go to Thread Tools.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. sendkeys method not working!
    By excelriddles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2015, 02:00 PM
  2. Replies: 9
    Last Post: 10-08-2014, 04:39 PM
  3. Bypass Outlook Security Setting when using Envelope in Workbook Method
    By g1987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2012, 02:58 PM
  4. Followhyperlink method only in Worksheet?
    By chevelle8719 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2010, 11:31 AM
  5. FollowHyperLink, method POST
    By d.tiles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2010, 10:20 AM
  6. FollowHyperlink Method
    By Keith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2005, 11:05 AM
  7. FollowHyperlink Method
    By ngedwin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2005, 01:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1