Email automation - hyperlink filepath

AndyEd

Board Regular
Joined
May 13, 2020
Messages
124
Office Version
  1. 365
Platform
  1. Windows
I have had some assistance with hyperlinking a filepath via a direct Cell reference in a Workbook. I am attempting to carry out the same procedure via a VLookup, but without success. Would someone be able to have a look at the code below and offer a reason it is not working.

VBA Code:
Dim wdDoc As Object
 
    With CreateObject("outlook.application").createitem(0)
        .To = ThisWorkbook.Worksheets("Lookups").Application.VLookup(Me.ComboBox.value, ThisWorkbook.Worksheets("Lookups").Range("D:E"), 2, False)
        .Subject = "Title"
        .Body = " Body text."
        .sentonbehalfofname = "email address"
        .display
        Set wdDoc = .GetInspector.WordEditor
        wdDoc.Hyperlinks.Add wdDoc.Range(0, 0), ThisWorkbook.Worksheets("Tracker").VLookup(Me.cboSelectFileReference.value, ThisWorkbook.Worksheets("Tracker").Range("C:S"), 16, False), , ,                          Me.cboSelectFileReference.value
        '.send
    End With

Thank you.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Sorry if this is too late, but VLookup is not a specific VBA command. You have to reword it as Application.WorksheetFunction.VLookup(...
 
Upvote 0

Forum statistics

Threads
1,215,669
Messages
6,126,125
Members
449,293
Latest member
yallaire64

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top