Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
Is this possible? I'm using this from Ron...
Code ------------------- Dim strDate As String Sheets("Quote").Copy strDate = Format(Date, "dd-mm-yy") ActiveWorkbook.SaveAs "Your Synthetic Shield " & ThisWorkbook.Name _ & " " & strDate & ".xls" ActiveWorkbook.SendMail "", _ "This is the Subject line" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close Fals ------------------- But I want the Subject line to be values from a range, is thi possible -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
Sure
http://www.rondebruin.nl/sendmail.htm#Tips -- Regards Ron de Bruin http://www.rondebruin.nl "RPIJG " wrote in message ... Is this possible? I'm using this from Ron... Code: -------------------- Dim strDate As String Sheets("Quote").Copy strDate = Format(Date, "dd-mm-yy") ActiveWorkbook.SaveAs "Your Synthetic Shield " & ThisWorkbook.Name _ & " " & strDate & ".xls" ActiveWorkbook.SendMail "", _ "This is the Subject line" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False -------------------- But I want the Subject line to be values from a range, is this possible? --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
Ok, so now I'm using
Code ------------------- Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy ") Application.ScreenUpdating = False Sheets("Quote").Copy Set wb = ActiveWorkbook With wb .SaveAs "Quote " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = "" .CC = "" .BCC = "" .Subject = "Your Synthetic Shield Invoice for your " + Sheets("Quote").Range("E47").Text + Sheets("Quote").Range("E49").Text + Sheets("Quote").Range("E51").Text .Body = "Here is your Synthetic Shield Invoice as you requested. Thanks Again for your service." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Display End With .ChangeFileAccess xlReadOnly Kill .FullName End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothin ------------------- and I'm recieving an error at the DimApp line (the first line), checked to make sure I had made the reference and it was there? wher have I gone wrong -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
RPIJG
What is the error you are getting? Check the references again. Make sure there is a check next to Microsoft Outlook x.0 Object Library. Just selecting the entry doesn't set the reference, you have to put a check by it. Also, don't confuse it with Microsoft Office x.0 Object Library. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "RPIJG " wrote in message ... Ok, so now I'm using Code: -------------------- Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy ") Application.ScreenUpdating = False Sheets("Quote").Copy Set wb = ActiveWorkbook With wb .SaveAs "Quote " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = "" .CC = "" .BCC = "" .Subject = "Your Synthetic Shield Invoice for your " + Sheets("Quote").Range("E47").Text + Sheets("Quote").Range("E49").Text + Sheets("Quote").Range("E51").Text .Body = "Here is your Synthetic Shield Invoice as you requested. Thanks Again for your service." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Display End With .ChangeFileAccess xlReadOnly Kill .FullName End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing -------------------- and I'm recieving an error at the DimApp line (the first line), I checked to make sure I had made the reference and it was there? where have I gone wrong? --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
.Subject = "Your Synthetic Shield Invoice for your " + Sheets("Quote").Range("E47").Text + Sheets("Quote").Range("E49").Text +
Sheets("Quote").Range("E51").Text Instead of + use & -- Regards Ron de Bruin http://www.rondebruin.nl "RPIJG " wrote in message ... Ok, so now I'm using Code: -------------------- Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy ") Application.ScreenUpdating = False Sheets("Quote").Copy Set wb = ActiveWorkbook With wb .SaveAs "Quote " & ThisWorkbook.Name _ & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = "" .CC = "" .BCC = "" .Subject = "Your Synthetic Shield Invoice for your " + Sheets("Quote").Range("E47").Text + Sheets("Quote").Range("E49").Text + Sheets("Quote").Range("E51").Text .Body = "Here is your Synthetic Shield Invoice as you requested. Thanks Again for your service." .Attachments.Add wb.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Display End With .ChangeFileAccess xlReadOnly Kill .FullName End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing -------------------- and I'm recieving an error at the DimApp line (the first line), I checked to make sure I had made the reference and it was there? where have I gone wrong? --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Defining the subject of an Email by value in range
Yeah I didn't set the reference right...and I used the & instead of + i
works great now, thanks everyone for all of your help -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
email hyperlink - cell value in subject line | Excel Discussion (Misc queries) | |||
Email subject | Excel Discussion (Misc queries) | |||
Auto email from excel with custom subject | Excel Discussion (Misc queries) | |||
Using VB, specific cell data into email subject | Excel Discussion (Misc queries) | |||
Code to Email with UNC in subject line | Excel Programming |