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

aattas

Registered User.
Local time
Today, 21:36
Joined
Dec 24, 2014
Messages
74
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:36
Joined
May 7, 2009
Messages
19,169
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, 18:36
Joined
Sep 21, 2011
Messages
14,046
I do not think you need the single quotes?
Put it all in a string and Debug.Print the string.
 

Dreamweaver

Well-known member
Local time
Today, 18:36
Joined
Nov 28, 2005
Messages
2,466
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
 

Dreamweaver

Well-known member
Local time
Today, 18:36
Joined
Nov 28, 2005
Messages
2,466
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