Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default emailing a workbook from within excel

I have tried using both of the following methods, to send an email from
within a workbook, both have failed. The purpose for this is to notify a
manager that a report is to be looked at. I hope that someone can help.
Cheers D



Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub



Private Sub MailWorkbook()

ThisWorkbook.SendMail (cboxProjectDirector.Value &
& " Status Report" & Format(Date,
"dd/mmm/yy"))

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default emailing a workbook from within excel

Damien,
Have a look he
http://www.rondebruin.nl/sendmail.htm


--
Regards

Corey

"Damien" wrote in message
...
I have tried using both of the following methods, to send an email from
within a workbook, both have failed. The purpose for this is to notify a
manager that a report is to be looked at. I hope that someone can help.
Cheers D



Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub



Private Sub MailWorkbook()

ThisWorkbook.SendMail (cboxProjectDirector.Value &
& " Status Report" & Format(Date,
"dd/mmm/yy"))

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default emailing a workbook from within excel

Hi Corey,
I have looked at Ron's website and with the following code I still get an
error message saying object required on the .To= cboxProjectDirector.Value &
" line of code. D

Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Test email"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub




"Corey" wrote:

Damien,
Have a look he
http://www.rondebruin.nl/sendmail.htm


--
Regards

Corey

"Damien" wrote in message
...
I have tried using both of the following methods, to send an email from
within a workbook, both have failed. The purpose for this is to notify a
manager that a report is to be looked at. I hope that someone can help.
Cheers D



Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub



Private Sub MailWorkbook()

ThisWorkbook.SendMail (cboxProjectDirector.Value &
& " Status Report" & Format(Date,
"dd/mmm/yy"))

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default emailing a workbook from within excel

Hi Damien

Is cboxProjectDirector a named cell or ?


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Damien" wrote in message ...
Hi Corey,
I have looked at Ron's website and with the following code I still get an
error message saying object required on the .To= cboxProjectDirector.Value &
" line of code. D

Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Test email"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub




"Corey" wrote:

Damien,
Have a look he
http://www.rondebruin.nl/sendmail.htm


--
Regards

Corey

"Damien" wrote in message
...
I have tried using both of the following methods, to send an email from
within a workbook, both have failed. The purpose for this is to notify a
manager that a report is to be looked at. I hope that someone can help.
Cheers D



Sub Mail_workbook_Outlook()
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = cboxProjectDirector.Value & "
.CC = ""
.BCC = ""
.Subject = cboxProjectList.Value & " Status Report" & Format(Date,
"dd/mmm/yy") & ".xls"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub



Private Sub MailWorkbook()

ThisWorkbook.SendMail (cboxProjectDirector.Value &
& " Status Report" & Format(Date,
"dd/mmm/yy"))

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
Saving / emailing sinlge excel sheet, not entire workbook BRCorprado Excel Discussion (Misc queries) 2 September 17th 09 10:34 PM
Emailing Workbook bart Excel Discussion (Misc queries) 1 November 5th 07 08:05 PM
Emailing an Excel Workbook with Links Frank G Links and Linking in Excel 2 June 29th 07 03:54 PM
Emailing an Excel Workbook with Links Frank G Excel Discussion (Misc queries) 0 April 11th 07 07:46 PM
Emailing a workbook Jmmac04 Excel Discussion (Misc queries) 0 November 22nd 05 05:20 PM


All times are GMT +1. The time now is 12:42 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"