I have a userform that i want to use to prepopulate an email. However when i click the button at the email, i get a "user definted.." error message.
Please can you help in check the error in the code. Thank you!
Private Sub CommandButton1_Click()
Dim OutApp As Outlook.Application
Dim MyItem As Outlook.MailItem
Dim blnOLOpen As Boolean
'Open Outlook if not open already
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
blnOLOpen = True
If OutApp Is Nothing Then
Set OutApp = CreateObject("Outlook.Application")
blnOLOpen = False
Shell ("OUTLOOK")
End If
On Error GoTo 0
Set MyItem = OutApp.CreateItem(olMailItem)
With MyItem
.To = "eagleinsight@eagleinsight.com"
.Subject = ListBox7.Value & / & TextBox2.Value & / & TextBox4.Value & / & ListBox1.Value & _
.Body = "A: " & ListBox7.Value & ListBox8.Value & vbNewLine & _
"B*: " & TextBox2.Value & vbNewLine & _
"C: " & TextBox3.Value & vbNewLine & _
"D: " & ListBox1.Value & vbNewLine & _
"E: " & ListBox2.Value & vbNewLine & _
"F: " & TextBox5.Value & vbNewLine & _
"G: " & TextBox4.Value & vbNewLine & _
"H: " & ListBox5.Value & vbNewLine & _
"I: " & ListBox6.Value & vbNewLine & _
.display End With
End Sub
Bookmarks