Results 1 to 2 of 2
  1. #1
    Douglas Post is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Location
    Portage, MI
    Posts
    9

    Email and Outlook

    My goal is to send Email thru Outlook from MS Access utilizing certain fields in my form. I am testing the concept with the following code:

    Code:
    Private Sub Send_Info_Click()
    
    Dim Email As String
    
    '**create variables for Outlook
    Dim objOutlook As Object
    Dim objEmail As Object
    
    '**gathers information from your form.  this sets the string variable to your fields
    Email = Me!Email
    
    '***creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.Application")
    Set objEmail = objOutlook.CreateItem(olMailItem)
    
    '***creates and sends email
    With objEmail
        .To = Email
        .Body = "TESTING INSERTING TEXT IN BODY OF EMAIL"
        .Display 'SEND sends the email in Outlook.  Change to DISPLAY if you want to be able to modify or see what you have created before sending the email
    End With
    
    '**Closes Outlook
    '**objOutlook.Quit
    '**Set objEmail = Nothing
    
    Exit Sub
    '****end code****
    End Sub
    The issue I am running into is that the Email field is saves as a Data Type "Hyperlink". I have done this because sometimes I just want to send an email easily without additional text. It causes a problem with the above code as my email looks like this once it opens up the mail client:

    Code:
    someemail@yahoo.com#mailto:someemail@yahoo.com#
    Is there a way to truncate it to remove everything between the # marks?



    Also my auto signature does not appear. Is there a switch for this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Try:

    x = someemail@yahoo.com#mailto:someemail@yahoo.com#

    Left(x, InStr(x, "#") - 1)

    There is a .AddBusinessCard. Don't see anything for signature.

    This offers solution that adds signature text to .Body: http://www.rondebruin.nl/mail/folder3/signature.htm
    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.

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

Similar Threads

  1. Import Outlook email message
    By crowegreg in forum Import/Export Data
    Replies: 5
    Last Post: 09-27-2011, 11:10 PM
  2. email with outlook.application
    By JJCHCK in forum Access
    Replies: 5
    Last Post: 08-25-2011, 06:19 AM
  3. Replies: 2
    Last Post: 07-29-2011, 12:33 PM
  4. Send email from Access thru Outlook
    By ZMAN in forum Forms
    Replies: 2
    Last Post: 11-27-2010, 06:10 PM
  5. Passing Email Address Into Outlook
    By cg1465 in forum Access
    Replies: 1
    Last Post: 10-01-2010, 07:59 AM

Tags for this Thread

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