Results 1 to 3 of 3
  1. #1
    SShort is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2022
    Posts
    1

    Access - Sending outlook template email from button

    The code below is producing name@email.com#mailto:name@email.com# in the to field of the email. How do I fix the code so it will only produce name@email.com?

    Dim myOlApp As Outlook.Application
    Dim MyItem As Outlook.MailItem
    Set myOlApp = CreateObject("Outlook.Application")
    Set MyItem = myOlApp.CreateItemFromTemplate("C:\samplefile.oft" )
    MyItem.To = Email


    MyItem.Display

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,008
    Inspect what is in the template email first?
    Use .display or look at the template in outlook.
    Even look at what Email contains.?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I suspect your email field has the hyperlink data type:

    https://codekabinett.com/rdumps.php?...link-data-type
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 14
    Last Post: 06-19-2020, 03:44 PM
  2. Sending Email from Access using Outlook
    By dccjr3927 in forum Programming
    Replies: 3
    Last Post: 06-26-2019, 12:16 PM
  3. Sending a value from Access to Outlook email
    By George in forum Import/Export Data
    Replies: 8
    Last Post: 09-03-2018, 02:53 AM
  4. Replies: 1
    Last Post: 06-19-2018, 10:38 AM
  5. Replies: 3
    Last Post: 09-01-2010, 08:43 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