in the body of an email.
I have a VBA userform that enters tasks into a spreadsheet. It also emails the information from that form to the person that has the responsibility of assigning these tasks. The form also assigns an Entry Number to each task in the spreadsheet. Since this information is in the spreadsheet and not the form, how do I get it to email in the body of the email along with the information from the form.
Any help with this would be greatly appreciated! ray:
The code I am using to create the Entry Number is:
' Creat Record number
NextRow = Range("A65536").End(xlUp).Row
Cells(NextRow, 15) = NextRow - 1
The code I am using to email the information from the form is:
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "myemail@email.com"
.CC = ""
.BCC = ""
.Subject = "B2B Tracking-New Task (TEST-PLEASE IGNORE)"
.Body = "Associate taking the request:" & vbCrLf &
NewTaskForm.AsscNameTxt1.Value & vbNewLine & vbNewLine & _
"Date Request Received:" & vbCrLf & NewTaskForm.DateRecTxt1.Value & vbNewLine & vbNewLine & _
"Date Request Promised:" & vbCrLf & NewTaskForm.DateExpTxt1.Value & vbNewLine & vbNewLine & _
"Person Requesting Job:" & vbCrLf & NewTaskForm.RequestNameTxt1.Value & vbNewLine & vbNewLine & _
"Contact Number:" & vbCrLf & NewTaskForm.ContactNumberTxt1.Value & vbNewLine & vbNewLine & _
"Email Address:" & vbCrLf & NewTaskForm.EmailTxt1.Value & vbNewLine & vbNewLine & _
"Name On Account:" & vbCrLf & NewTaskForm.AcctNameTxt1.Value & vbNewLine & vbNewLine & _
"Number of Mobiles:" & vbCrLf & NewTaskForm.MobilesTxt1.Value & vbNewLine & vbNewLine & _
"Account Number:" & vbCrLf & NewTaskForm.AcctNumberTxt1.Value & vbNewLine & vbNewLine & _
"Market:" & vbCrLf & NewTaskForm.ComboMarkets1.Value & vbNewLine & vbNewLine & _
"Details of Request:" & vbCrLf & NewTaskForm.DetailsTxt1.Value
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
I have a VBA userform that enters tasks into a spreadsheet. It also emails the information from that form to the person that has the responsibility of assigning these tasks. The form also assigns an Entry Number to each task in the spreadsheet. Since this information is in the spreadsheet and not the form, how do I get it to email in the body of the email along with the information from the form.
Any help with this would be greatly appreciated! ray:
The code I am using to create the Entry Number is:
' Creat Record number
NextRow = Range("A65536").End(xlUp).Row
Cells(NextRow, 15) = NextRow - 1
The code I am using to email the information from the form is:
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "myemail@email.com"
.CC = ""
.BCC = ""
.Subject = "B2B Tracking-New Task (TEST-PLEASE IGNORE)"
.Body = "Associate taking the request:" & vbCrLf &
NewTaskForm.AsscNameTxt1.Value & vbNewLine & vbNewLine & _
"Date Request Received:" & vbCrLf & NewTaskForm.DateRecTxt1.Value & vbNewLine & vbNewLine & _
"Date Request Promised:" & vbCrLf & NewTaskForm.DateExpTxt1.Value & vbNewLine & vbNewLine & _
"Person Requesting Job:" & vbCrLf & NewTaskForm.RequestNameTxt1.Value & vbNewLine & vbNewLine & _
"Contact Number:" & vbCrLf & NewTaskForm.ContactNumberTxt1.Value & vbNewLine & vbNewLine & _
"Email Address:" & vbCrLf & NewTaskForm.EmailTxt1.Value & vbNewLine & vbNewLine & _
"Name On Account:" & vbCrLf & NewTaskForm.AcctNameTxt1.Value & vbNewLine & vbNewLine & _
"Number of Mobiles:" & vbCrLf & NewTaskForm.MobilesTxt1.Value & vbNewLine & vbNewLine & _
"Account Number:" & vbCrLf & NewTaskForm.AcctNumberTxt1.Value & vbNewLine & vbNewLine & _
"Market:" & vbCrLf & NewTaskForm.ComboMarkets1.Value & vbNewLine & vbNewLine & _
"Details of Request:" & vbCrLf & NewTaskForm.DetailsTxt1.Value
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing