Creating a hyperlink in VBA when sending an email from Outlook . (1 Viewer)

aattas

Registered User.
Local time
Today, 05:24
Joined
Dec 24, 2014
Messages
71
Colleagues,
MS Access 2016, I have a hyperlink field called LINK, and in the form the address is entered into the field.
I got through VBA, the LINK address appeared in the email and also hyperlinked, but I cant understand why it didn't go the address, it did say " CTRL+Click to follow link", and it displays the address that I want it to go to, but when I click it didn't go anywhere . Help
the code is as follows:

" <br/>A new Letter pertaining to your department is attached, please use the link to go the system for your update <a href='" & LINK & "' > Letter, click here</a>. ! " & vbCr & _
 

arnelgp

error reading drive A:
Local time
Today, 10:24
Joined
May 7, 2009
Messages
12,012
what is the link is it a file, an internet address?
you may use:

<a href="file:///thepath here">Link name</a>
<a href="HTTP://internetPath">Link name</a>
<a href="FTP://ftp path">Link name</a>
<a href=mailto://mail address">link name</a>
 

Gasman

Enthusiastic Amateur
Local time
Today, 03:24
Joined
Sep 21, 2011
Messages
7,898
I do not think you need the single quotes?
Put it all in a string and Debug.Print the string.
 

MickJav

Well-known member
Local time
Today, 03:24
Joined
Nov 28, 2005
Messages
2,436
I have done this but not on PC at moment if nobody comes up with the code I'll post it in about 3 hrs
 

MickJav

Well-known member
Local time
Today, 03:24
Joined
Nov 28, 2005
Messages
2,436
I assume outlook is your default Mail System
I use this with thunderbird

Code:
Private Sub CmdCode_Click()
Dim Str As String, Strp As String
On Error GoTo HandleErr

If Not IsNothing(Me![Registered]) Then Exit Sub
'Location Of Image To Attach"
Strp = "file:///E:/Database%20Dreams/Project%20Manager/Database%20Dreams1.jpg"
'Add above to the Html Img Tags and
Str = "<img src=" & Strp & " alt='Database Dreams'>" & vbCrLf & vbCrLf & "Thankyou for choosing Database Dreams - " & Me![CboProject].Column(1) & _
    vbCrLf & "Please copy the line below and past it into the customer code box" & _
    vbCrLf & vbCrLf & Me![CboCustomer] & "-" & Me![CboProject].Column(2) & vbCrLf & vbCrLf & "Should you need assistance please goto" & vbCrLf & _
    "<a href='" & Me![CboProject].Column(3) & "'>Database Dreams - " & Me![CboProject].Column(1) & " Boards</a>"
   ' Debug.Print Str
DoCmd.SendObject acSendNoObject, , , Me![DfltMail], , , "Registraction Code", Str, True

Me![Registered] = Date

HandleExit:
    Exit Sub
    
HandleErr:
    Select Case Err.Number
        Case 2501 'Cancel = True
            Exit Sub
        Case Else
            Call GlobalErrs(Err.Number, Err.Description, Err.Source, "ZfrmRegistrations", "CmdCode_Click")
            Resume HandleExit
        Resume
    End Select
End Sub
 

Users who are viewing this thread

Top Bottom