Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
E-Mailing Question
I've taken some code from Ron De Bruins excellent E-mailing from Excel, but
have a couple of questions that as a novice I can't figure out. The code I'm using is for Outlook only and is (slightly tweaked) Q 1 - If I wish to place in the "To" a variable, such as a cell reference (because this cell's value may change) how can I place that within the code. Say Sheet1 A10 Q2 - SImilar to Q1, how can I place in the "Subject Line" a variable cell reference, say Sheet1 B10 Thanks Sub Mail_Outlook() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm") Application.ScreenUpdating = False Sheets("E-Schedule").Visible = True Sheets(Array("E-Schedule")).Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & "Sent on" & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = "Hi there" .Attachments.Add wb.FullName .Send 'or .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
E-Mailing Question
Hi John
Click on the Tips link that is on every example page http://www.rondebruin.nl/mail/tips2.htm -- Regards Ron De Bruin http://www.rondebruin.nl "John" wrote in message ... I've taken some code from Ron De Bruins excellent E-mailing from Excel, but have a couple of questions that as a novice I can't figure out. The code I'm using is for Outlook only and is (slightly tweaked) Q 1 - If I wish to place in the "To" a variable, such as a cell reference (because this cell's value may change) how can I place that within the code. Say Sheet1 A10 Q2 - SImilar to Q1, how can I place in the "Subject Line" a variable cell reference, say Sheet1 B10 Thanks Sub Mail_Outlook() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm") Application.ScreenUpdating = False Sheets("E-Schedule").Visible = True Sheets(Array("E-Schedule")).Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & "Sent on" & " " & strdate & ".xls" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = " .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = "Hi there" .Attachments.Add wb.FullName .Send 'or .Display End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True Set OutMail = Nothing Set OutApp = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I need to import my Excel Mailing list into mailing label format. | Excel Discussion (Misc queries) | |||
I need to import my Excel Mailing list into mailing label format. | Excel Discussion (Misc queries) | |||
mailing | Excel Programming | |||
how do i convert MS Word mailing labels into an Excel mailing lis. | Excel Discussion (Misc queries) | |||
Mailing from Excel and message question | Excel Programming |