Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default CC the Sender in VBA Code

I am trying to have my macro CC the sender of the excel file as an
attachment. Here is my code:

Sub Mail_workbook_Outlook_1()
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = From.Name
.BCC = ""
.Subject = ActiveWorkbook.Name
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


Again, I want to CC the sender so they have confirmation they sent the
email. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default CC the Sender in VBA Code

This is not easy

See this site to find the mail address
http://vbnet.mvps.org/

Search for
RegQueryValueEx: Retrieve Email Account Info (Outlook)


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Eric" wrote in message ...
I am trying to have my macro CC the sender of the excel file as an
attachment. Here is my code:

Sub Mail_workbook_Outlook_1()
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = From.Name
.BCC = ""
.Subject = ActiveWorkbook.Name
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


Again, I want to CC the sender so they have confirmation they sent the
email. Thanks!

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
How to cc the sender using vba and outlook cluckers Excel Discussion (Misc queries) 0 December 31st 09 06:13 PM
Survey - Return to sender Steve Goodrich Excel Discussion (Misc queries) 1 February 23rd 09 08:12 PM
Outlook/Excel return code to know if Sender pressed the SEND butto gary Excel Programming 0 July 18th 07 10:46 PM
Retrieve Sender in Calculate Event Peter Excel Programming 0 February 27th 06 04:09 AM
Sender? Emmgonzalez Excel Programming 2 November 21st 05 02:19 PM


All times are GMT +1. The time now is 12:10 PM.

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"