Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Location
    Australia
    Posts
    23

    Unanswered: Use textbox contents with SendObject command

    Hi all,

    I am creating a form to send a basic email.

    I have already been able to make one that works with the SendObject command and uses an inputbox for the body text.

    However, i want to make one that will take the information from a text box and insert it into the body of the email so i can make it easier to write content.

    This is what i have
    Code:
    Private Sub EmailButton_Click()
    Dim emailaddress As String
    emailaddress = "Emailme@emailaddress.com"
    
    Docmd.SendObject , , , emailaddress, , , "Email Subject", EmailBody, True
    End Sub
    EmailBody is the name of the text box (in red). I am unsure on how to refer to it in the SendObject vba. I have tried me.emailbody, textbox.emailbody and nothing seems to work.

    Anyone have any ideas?
    You can use statistics to prove anything - 78% of people know that!

  2. #2
    Join Date
    May 2012
    Location
    Australia
    Posts
    23

    Cool

    Solved it. I should look at my other code for hints lol

    Code:
    Private Sub EmailButton_Click()
    Dim emailaddress As String
    Dim emailtext as string
    
    emailaddress = "Emailme@emailaddress.com"
    emailtext = me.EmailBody
    
    Docmd.SendObject , , , emailaddress, , , "Email Subject", emailtext, True
    End Sub
    It now sends an email to the specified address with whatever is entered in the text box as the body text.
    You can use statistics to prove anything - 78% of people know that!

Posting Permissions

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