Trying to get the information in 1 cell to show up

rayzgurl

New Member
Joined
Feb 4, 2004
Messages
35
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! :pray:

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
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
To go in the Subject line...

Code:
.Subject = "B2B Tracking-New Task #" & NextRow - 1

or into the body of the message...

Code:
.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 & vbCrLf & _
"New Task #: " & NextRow - 1

hth
 

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,923
Members
414,416
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top