VBA to call hyperlink in cell

Excel Jr

New Member
Joined
Aug 17, 2018
Messages
26
Hello,

Is anyone aware of how I can call a mailto: hyperlink in a cell to activate using VBA?

I've tried all of the following.

Code:
Sub Test()
Worksheets("Sheet1").Range("B7").Select
End Sub

and

Code:
Sub Test()
Dim CurrentPath As String
CurrentPath = Application.ActiveWorkbook.FullName
ActiveWorkbook.FollowHyperlink (CurrentPath)
End Sub

and

Code:
Sub Test()
Dim CurrentPath As String
CurrentPath = Application.ActiveWorkbook.FullName
ActiveWorkbook.FollowHyperlink (CurrentPath, Worksheets("Sheet1").Range("B7"))
End Sub

Note: I can't use a fixed path as this file will be used and saved by random people.

Also, the mailto is not static. It can be up to 1-3 emails depending on other cells. I realize I could code these into VBA, but honestly it's much easier to handle in a sheet. It's also much easier for others to update. There has to be a simple way to call a hyperlink in cell. Right?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Here is the hyperlink formula:
Code:
=HYPERLINK("mailto:americas@gmail.com?"&"cc="&B2&";"&B3&"&subject=New Form Has Been Submitted")

Please note: this is a workaround I'm trying for Macs, so I can't use Call Outlook, .Shell, or IE workarounds.

Thanks!
 
Last edited:
Upvote 0
I was able to figure it out. Leaving this here as I never saw it anywhere on my journey throughout multiple Excel forums.

Code:
ThisWorkbook.FollowHyperlink (Worksheets("Sheet1").Range("B7"))
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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