Link to home
Start Free TrialLog in
Avatar of dan_nolan
dan_nolan

asked on

VBA Inserting a hyperlink to a file on a network in the body of an email

Hello,

I'm using Access 2003 VBA to automate sending an email to a group of co-workers that a file on a network shared drive has been updated.  I'd link to send a link to the file in the email, instead of attaching it, so the user can click on the link to open the file.  How can I program a link to the file in VBA?  I've been trying to figure this out for almost a day.  Please help.
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

I'm not getting it. You are able to construct the mail with VBA as I understand so what prevents you from just inserting the text

"http://computer/path_to_/this_file"

Every email program I know allows you to click on a link and get to that page.

It's so easy that I'm sure I get you wrong, and answering a different question?

Regards
Friedrich
ASKER CERTIFIED SOLUTION
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dan_nolan
dan_nolan

ASKER

Thanks for your response but I was able to figure it out.  This is how I finally got it to work:

With olMailItem
            .BodyFormat = olFormatHTML
            .HTMLBody = strFName & "<br><br>" & strLtrContent & "<br>" _
                        & "<br>" & "<a href='file://" & strProdOpsHdcnt & "'>Prod Ops Headcount Report</a>" _
                        & "<br>" & "<a href='file://" & strDepttable & "'>Department Table</a>" _
                        & "<br>" & "<a href='file://" & strHourlyalpha & "'>Hourly Alpha Listing </a>" _
                        & "<br>" & "<a href='file://" & strHourlyoccgroup & "'>Hourly Occ Group Listing </a>" _
                        & "<br>" & "<a href='file://" & strHourlyprob & "'>Hourly Probationary Report </a>" _
                        & "<br>" & "<a href='file://" & strHourlyterm & "'>Hourly Termination Report </a>"
            .Subject = "Weekly Hourly Reports"
           
        End With

Initially I tried just inserting the link but it wouldn't work and came across in the email as plain text.  Was there an easier way?
that looks right, sorry for the slow repsonse just been sorting a few things out and wasnt able to test it :) But glad to see you worked it out. Appreicate the grade even though I didnt really deserve it.
It worked exactly as I suggested, so I got you right...
Friedrich