Results 1 to 5 of 5
  1. #1
    Corey is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    11

    Sendoject - Hyperlink display as a word not URL path

    I am using VB to sendobject/email. I have a strbody used to capture all email details, so my docmd.sendobject.....,strbody (messagetext).

    Code:
    strBody = "Hello" & Space(1) & [Forms]![CustomerUsers_Send_frm]![First Name] & "," & Chr(10) & vbCrLf _
            & DLookup("[EmailMessage]", "WelcomeEmail") & Chr(10) & vbCrLf _
            & "US Toll Free" & Space(1) & DLookup("[TollFreeNum]", "WelcomeEmail") & vbCrLf _
            & "US Direct" & Space(1) & DLookup("[DirectNum]", "WelcomeEmail") & Chr(10) & vbCrLf _
            & "Thank you," & Chr(10) & vbCrLf _
            & "Company Management" & vbCrLf _
            & "Company Services" & Chr(10) & vbCrLf _
            & DLookup("[Tag]", "WelcomeEmail") & vbCrLf _
            & DLookup("[Policy]", "WelcomeEmail")
    
    DoCmd.SendObject acSendReport, "WelcomeLetter_rpt", acFormatPDF, [Forms]![CustomerUsers_Send_frm]![Email], DLookup("[CC DL]", "Customers", "[Customer]=[Forms]![CustomerUsers_Send_frm]![Customer]") & "," & DLookup("[MgrEmail]", "Customers", "[Customer]=[Forms]![CustomerUsers_Send_frm]![Customer]"), , "Welcome New Company ABC Portal User", strBody, True
    But I need the hyperlink to be displayed in the email as "Policy"...not the URL path.



    Any help greatly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Think will have to use HTML code tags http://www.w3schools.com/tags/tag_a.asp

    However, don't know if that will work with SendObject. I use Outlook automation to send email:

    Dim appOutLook As outlook.Application
    Dim MailOutLook As outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = ""
    ''.cc = ""
    ''.bcc = ""
    .Subject = "text"
    .HTMLBody = "text" & Now
    .DeleteAfterSubmit = True
    ''.Display
    .Send
    End With
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Corey is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    11
    Any reason this doesn't work? Compile error is: "User-defined type not defined"

    Code:
    Dim appOutLook As New Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = [Forms]![CustomerUsers_Send_frm]![Email]
    .cc = DLookup("[CC DL]", "Customers", "[Customer]=[Forms]![CustomerUsers_Send_frm]![Customer]") & "," & DLookup("[MgrEmail]", "Customers", "[Customer]=[Forms]![CustomerUsers_Send_frm]![Customer]")
    .Subject = "Welcome Letter"
    .HTMLBody = "Hello" & Space(1) & [Forms]![CustomerUsers_Send_frm]![First Name] & ","" & Now"
    .Attachments.Add ("C:\Access db\Onboard\Portal.pdf")
    .DeleteAfterSubmit = True
    .Display
    End With
    End Sub

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Need to set VBA reference to Microsoft Outlook x Object Library.

    However, not using HTML code tags.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Corey is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    11
    June7 - Thank you!...Thank you!....Thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Default path for Insert hyperlink code
    By jaworski_m in forum Programming
    Replies: 3
    Last Post: 02-13-2015, 10:42 AM
  2. Insert hyperlink - ensure absolute path
    By jaworski_m in forum Programming
    Replies: 1
    Last Post: 02-04-2015, 11:39 AM
  3. Replies: 5
    Last Post: 10-28-2013, 08:09 AM
  4. Display Linked table Path
    By gg80 in forum Access
    Replies: 3
    Last Post: 10-14-2011, 10:02 PM
  5. Replies: 2
    Last Post: 07-31-2010, 11:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums