UserForm to send email

Antonio12

Board Regular
Joined
Jul 11, 2012
Messages
73
Hello All:

I'm hopping someone can help me with this so if you know, please do Help!!! I have office 2007 and run WinXP

I created a userform with 2 text boxes, 2 Checkboxes, a send button and a cancel button.

I need a code will allow the user to click send, and it will send the information on the userform straight to my email.

If possible I would like to have the Subject of the email with the information that is in the checkbox
In the text of the email the information that is in the first textbox
And finally the information that is in the other textbox.

Is this possible? Can someone please help!

Thank you all
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Antonio12

Board Regular
Joined
Jul 11, 2012
Messages
73
Thank you for the information, but it did not help. what i have so far is this:

Private Sub Enviar_Click()


Dim OutApp As Object
Dim OutMail As Object


Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)


On Error Resume Next
With OutMail
.To = "antonio.rodrigues@gmail.com"
.CC = ""
.BCC = ""
.Subject = "SL Report"
' .Display 'Comment Out This Line
.Send 'or use .Display 'Uncomment This Line
.Body = "This message was sent via a button on the form..."
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0


Set OutMail = Nothing
Set OutApp = Nothing


End Sub

Now what I need is the information in the userform to be sent along with the email. I have two textboxes and two checkboxs.
 

Antonio12

Board Regular
Joined
Jul 11, 2012
Messages
73

ADVERTISEMENT

Can somebody please help me!
 

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
969

ADVERTISEMENT

Antonio,

Since your code above contains your email address, I went ahead and sent an example workbook to you via that address. Feel free to take a look and ask more questions if needed.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,096
Messages
5,570,198
Members
412,308
Latest member
jt145
Top