Help: Access, email, and links

pholt33

Board Regular
Joined
Jan 4, 2005
Messages
202
Office Version
  1. 365
Platform
  1. Windows
I have a database (Access 2010) that is used to store and share documents across my small firm. People go into the database, fill out a form and attach whatever document they want available in a centralized location. On submission of a new record an email is generated with some basic info about the document (subject, title, etc) and some terminology stating (paraphrasing), "Hey, coworker, go check out this new publication." What I would like to do is include a link in the email that would allow the coworkers to open the file directly from the email rather than having to get into the database, look up the publication, and then finally open it.

How can I create that link and insert it into the email?

Thanks!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I find that Outlook , if you have the full file path, it creates the hyperlink. But the code below also has the hyperlink method commented out.

Rich (BB code):
Public Function EmailOut(ByVal pvTo, ByVal pvSubj, ByVal pvBody, Optional ByVal pvFile) As Boolean
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem
On Error GoTo ErrMail
'===== BE SURE TO ADD OUTLOOK OBJ LIBRARY in VBE,TOOLS, REFERENCES.   ========
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)
With oMail
    .To = pvTo
    .Subject = pvSubj
    If Not IsNull(pvBody) Then .Body = pvBody
    'If Not IsMissing(pvFile) Then .Attachments.Add pvFile, olByValue, 1, "attached file"
    
    .Send
End With
EmailOut = True
Set oMail = Nothing
Set oApp = Nothing
Exit Function
ErrMail:
MsgBox Err.Description, vbCritical, Err
Resume Next
Resume
End Function
 
Sub TestEmail()
Const Q = """"
Dim vBody
vBody = "\\serverpath\Support\\generic.pdf"
'vBody = "file:///\\serverpath\Support\\generic.pdf" & Q & ">\\serverpath\Support\\generic.pdf"

call  EmailOut( "bob@Co.com", "Hyperlink", vBody)
End Sub
 
Upvote 0
Thanks, that will be helpful!

Dumb question time...how do I find what the filepath is? When I open any saved file from the database, the file location says its in my local temp folder. That cant be right. The attachment field doesnt seem to give me any insight, either. It seems like this should be a very easy thing to figure out and Im stumped.
 
Upvote 0

Forum statistics

Threads
1,222,029
Messages
6,163,487
Members
451,838
Latest member
DonSlayer

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