Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to import my Excel Mailing list into mailing label format. Gord Dibben Excel Discussion (Misc queries) 0 November 5th 09 10:16 PM
I need to import my Excel Mailing list into mailing label format. Lyn Excel Discussion (Misc queries) 0 November 5th 09 08:11 PM
mailing ceemo[_45_] Excel Programming 0 November 2nd 05 08:06 AM
how do i convert MS Word mailing labels into an Excel mailing lis. unrhyll Excel Discussion (Misc queries) 1 February 4th 05 12:19 AM
Mailing from Excel and message question ZABU Excel Programming 2 January 17th 04 02:40 AM


All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"