Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a link in an email body from VBA

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
I have written some code to validate the Excel file attachment in Outlook. It copies the original sheet to sheet2 and highlights changes made in sheet1. If no changes are found it deletes sheet2 and saves it to a specified path.

I then email a user notifying them that a file has been received and processed. Regardless of whether or not changes have been made to the file, the user may wish to open it up and just take a look at it.

I have the file name and path available to me from the processing I am already doing, but I would like to include that information in a link in the email body so all they have to do is click it to view the file.

How do I code the link as I create the email message in VBA?

Thanks in advance for any help or suggestions you can give!

Have a great day!

 
Is this helpful - it creates an attachment that is a shortcut to a file.

Code:
Function fctnDemoAttachShortcut()

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objOutlookMsg.Attachments.Add "c:\temp\myfile.xls", olByReference
objOutlookMsg.Display

Set objOutlook = Nothing
End Function
[pc2]
 
Use the UNC for the path:

DoCmd.SendObject , , , "user@company.com", , , , "\\servername\sharename\filename.xls", False

Good luck

[pipe]
Daniel Vlas
Systems Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top