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
Bookmarks