VBA & Macro Problems

Send an Outlook Email with a Cell Hyperlink Using Excel VBA

Algirdas JasaitisAlgirdas Jasaitis Nov 14, 2026 868 views

Question details

Create an Outlook email from Excel VBA with a clickable link read from a worksheet cell instead of a file attachment.

Send an Outlook Email with a Cell Hyperlink Using Excel VBA
Product
Microsoft Excel and Outlook
Device & OS
not provided
Scenario
Reuse an Excel macro to email links to different files by changing a cell value.
Observed behavior
The email body contains a clickable hyperlink to the file, without attaching the file itself.
Before you start

Place an accessible file or web link in cell B2 of the worksheet you want to use. The example uses Outlook automation and requires desktop Excel and a compatible installed version of Outlook, such as classic Outlook for Windows.

Solution 1Recommended

Read a worksheet link and add it to an Outlook HTML email

Use this approach to change the destination by editing cell B2 rather than changing the macro.

1
Enter the link

In Excel, select the worksheet you want to use and enter the destination URL in cell B2. An HTTPS sharing link is preferable when available.

2
Open the VBA editor

Press Alt+F11, select Insert > Module, and paste this macro: Sub EmailCellLink() Dim outlookApp As Object Dim msg As Object Dim link As String link = CStr(ActiveSheet.Range("B2").Value) If Len(Trim$(link)) = 0 Then MsgBox "Enter a link in cell B2." Exit Sub End If link = Replace(link, "&", "&amp;") link = Replace(link, Chr$(34), "&quot;") link = Replace(link, "<", "&lt;") link = Replace(link, ">", "&gt;") Set outlookApp = CreateObject("Outlook.Application") Set msg = outlookApp.CreateItem(0) With msg .Subject = "File link" .HTMLBody = "<p>Please open the file:</p><p><a href=" & Chr$(34) & link & Chr$(34) & ">Open file</a></p>" .Display End With End Sub

3
Run and review the email

Return to the worksheet containing B2, press Alt+F8, select EmailCellLink, and click Run. In the Outlook draft, add recipients, review the link, and click Send.

Read a worksheet link and add it to an Outlook HTML email
Check access to shared files: Recipients need permission to access the destination. File links may require a valid shared path and can be blocked by email client or security policies; an HTTPS sharing link is often more reliable.
Free Microsoft Office alternative

Manage spreadsheets and file links with WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format support, making it easy to move existing spreadsheets into WPS. Outlook automation is a Microsoft Office-specific task and is not fixed by switching to WPS.

Work with spreadsheet cells that contain file or web linksOpen and edit Microsoft Excel formats such as XLSXUse a familiar spreadsheet interface for easier migrationAccess a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I use a different cell for the link?

In the VBA editor, change ActiveSheet.Range("B2") to the cell you want, such as ActiveSheet.Range("C2"). Select the relevant worksheet before running the macro.

Does the link have to start with HTTPS?

No. A file link can work if it points to a valid shared location that the recipient can access, but email clients or security policies may block it. Use an HTTPS sharing link when available.

Why can't the recipient open the linked file?

Check the sharing settings for the file or server location and confirm that the recipient has permission and network access. Also check whether their email client blocks file links.

Does the macro send the email automatically?

No. The example uses .Display to open a draft in Outlook. Add recipients and click Send after reviewing the message.