Create an Outlook HTML Email With One Link Using Excel VBA
Question details
Create an Outlook email from Excel VBA with ordinary text and a single clickable link.

- Product
- Microsoft Excel VBA and Microsoft Outlook
- Device & OS
- not provided
- Scenario
- An Excel macro builds an Outlook message using the HTMLBody property.
- Observed behavior
- The desired message has mostly unformatted text, with one line containing a clickable hyperlink.
Open the workbook in desktop Excel and make sure classic Outlook is installed and configured. The macro uses Outlook COM automation, which is not supported by the new Outlook for Windows.
Use HTMLBody with an anchor tag and line breaks
Use this method to keep most of the email visually plain while adding one clickable link.
HTMLBody can combine ordinary text with HTML tags. The message is still HTML, even though most of its text has no special formatting.
In Excel, press Alt+F11, then choose Insert > Module.
Paste this code into the module: Sub CreateEmailWithLink() Dim olApp As Object Dim olMail As Object Set olApp = CreateObject("Outlook.Application") Set olMail = olApp.CreateItem(0) With olMail .HTMLBody = "This is a usual text line<br>" & _ "The link: <a href=""http://www.google.com/"">Click Here</a><br>" & _ "Whatever" .Display End With End Sub
Replace the example URL, link text, and message lines in the code. Run CreateEmailWithLink from the VBA editor, then review and address the displayed Outlook message.

Work with Excel-compatible spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Office files. It can help you move everyday spreadsheet work from Microsoft Office, but it does not fix Outlook COM automation or guarantee compatibility with this VBA macro.

Frequently Asked Questions
Can an HTMLBody message contain ordinary text?
Yes. Put ordinary text directly in the HTMLBody string and use tags only where needed, such as <a> for the link and <br> for line breaks.
Why are there doubled quotation marks around the URL?
In a VBA string, doubled quotation marks produce a single quotation mark in the resulting HTML. For example, use href=""https://example.com"" inside the string.
Will this macro send the email automatically?
No. The example uses .Display to open the message for review. Add a recipient and send it from the Outlook window when it is ready.
Can I run this Outlook automation in the new Outlook for Windows?
No. The new Outlook for Windows does not support Outlook COM automation. Use classic Outlook for the CreateObject("Outlook.Application") approach.
Will assigning HTMLBody preserve an existing signature?
Not automatically. Assigning .HTMLBody replaces the current body, so capture and append any existing signature HTML if you need to retain it.




