+ Reply to Thread
Results 1 to 6 of 6

Sending Email from a form button using text fields to build the email

Hybrid View

jdoerr1021 Sending Email from a form... 05-19-2016, 06:57 PM
gmr4evr1 Re: Sending Email from a form... 05-19-2016, 07:27 PM
jdoerr1021 Re: Sending Email from a form... 05-19-2016, 08:15 PM
gmr4evr1 Re: Sending Email from a form... 05-20-2016, 08:14 AM
jdoerr1021 Re: Sending Email from a form... 06-05-2016, 10:17 AM
gmr4evr1 Re: Sending Email from a form... 06-05-2016, 10:22 PM
  1. #1
    Registered User
    Join Date
    09-22-2015
    Location
    Eau Claire, WI
    MS-Off Ver
    2010
    Posts
    65

    Sending Email from a form button using text fields to build the email

    I have a form that allows you to select a record from a query. It populates a number of text boxes with data from the table. I would like to use a macro attached to a button that will construct the email subject and body and send using HTML rather then plain text in outlook. The send object method does not appear that it will work for this. Occasionally, an attachment needs to be send also, which is stored in the tbl as well.

    Any help would be appreciated.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Sending Email from a form button using text fields to build the email

    Have you had a look at this site? One or both of the first 2 options should get you at least close to where you want to be.
    http://www.rondebruin.nl/win/section1.htm
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    09-22-2015
    Location
    Eau Claire, WI
    MS-Off Ver
    2010
    Posts
    65

    Re: Sending Email from a form button using text fields to build the email

    That looks good for Excel, but I am wondering for Microsoft Access.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Sending Email from a form button using text fields to build the email

    My bad....I didn't notice that you were asking for access. I know nothing about access. Sorry about that.

  5. #5
    Registered User
    Join Date
    09-22-2015
    Location
    Eau Claire, WI
    MS-Off Ver
    2010
    Posts
    65

    Re: Sending Email from a form button using text fields to build the email

    After much research and trial and error, I was able to figure it here. Code example for anyone interested:

    Option Compare Database
    
    Public Sub SendEmailP()
    Dim strEmail, strBody, strsubject As String
    Dim objOutlook As Outlook.Application
    Dim objEmail As Outlook.MailItem
    
    '**creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.application")
    Set objEmail = objOutlook.CreateItem(olMailItem)
    
    '**************************************************************
    '*create string with email address
    
    strEmail = txtEmail
    
    strBody = [Forms]![navigation]![NavigationSubform].[Form]![EmailVerbiage]
    strsubject = [Forms]![navigation]![NavigationSubform].[Form]![EmailSubject]
    
    
    '***creates and sends email
    With objEmail
        .To = "email address here"
        .Subject = strsubject
        .body = strBody
        .Display
    End With
    
    Exit Sub
    
    
    End Sub

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Sending Email from a form button using text fields to build the email

    Glad you were able to get it figured out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 11-24-2015, 03:29 AM
  2. [SOLVED] Button to automate sending two different worksheets as attachments via same email
    By jungleskipper1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2015, 08:47 AM
  3. Sending form from excel thru email as an attachment
    By Aplcinnamon in forum Excel General
    Replies: 1
    Last Post: 02-06-2015, 04:40 AM
  4. Sending Email from VBA - selecting correct email address issue
    By Rachieo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2014, 03:51 PM
  5. Replies: 6
    Last Post: 10-01-2013, 11:43 PM
  6. Saving data in form before sending it to email address
    By hsahota1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2010, 07:31 AM
  7. sending worksheet by email using control button
    By kiwicolin in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-24-2005, 12:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1