Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi, i have the code below where i have a userform which can be filled out then click on an email button to send to recipitents, but i keep getting errors and will not send, i have 9 different boxes where i want to copy the data from for example textbox1, textbox2, textbox3 and so forth. Pleasd can you help me many thanks for your time again.
Code:
Private Sub CommandButton4_Click()
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
aEmail.Body = "Appt Number: " & Me.TextBox1.Value & Chr(10) & _
"MPAN / MPRN: " & Me.TextBox2.Value & Chr(10) & _
"Time Slot: " & Me.TextBox3.Value & Chr(10) & _
"Address Line 1: " & Me.TextBox4.Value & Chr(10) & _
"Address Line 2: " & Me.TextBox5.Value & Chr(10) & _
"PostCode: " & Me.TextBox6.Value & Chr(10) & _
"Replan / T'band Ext: " & Me.ComboBox1.Value & Chr(10) & _
"Reason: " & Me.ComboBox2.Value & Chr(10) & _
"Additional Notes: " & Me.TextBox7.Value & Chr(10) & _
aEmail.Recipients.Add "test.test@test.com"
aEmail.CC = ""
aEmail.BCC = ""
aEmail.Subject = "Replan / T'Band Ext"
aEmail.Send
End Sub