LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Deferred Mailing from Outlook

Hi,

After doing enough research to warrant an automatic award of a Ph.D or two,
I have come up with the following gem.
Unfortunately, it doesn't work as it should!

The objective is to prepare an e-mail with an attachment and to place it in
the Drafts Folder for notes to be added prior to sending.

Sub DeferredMail()
Dim Fname, Sbjct

ActiveSheet.Copy
Fname = "C:\MailTemp\" & "TempMail.xls"
ActiveWorkbook.SaveAs Fname
ActiveWorkbook.Close False
Sbjct = "Just Testing"

Dim olApp As Object
Dim olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)

With olApp
..Session.GetDefaultFolder (16) '(olFolderDrafts)
With olMail
.To = "
.Subject = Sbjct
.Body = "Notes:"
.Attachments.Add Fname
.Save
End With
End With

Set olApp = Nothing
Set olMail =
End Sub

The problem is as follows:
If the routine is run when Outlook is open, it works as intended and the
e-mail goes to the Drafts Folder.
However, if Oulook in NOT open when the routine is run, when it is
subsequently opened, the e-mail appears in the Inbox, which is not
acceptable.

Any ideas ?

TIA
regards'

Don



 
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 do i convert a mailing list in excel to outlook chvbob Excel Discussion (Misc queries) 4 October 14th 05 05:43 PM
which is best for mailing list management, Outlook or Excel? Thrival New Users to Excel 1 March 4th 05 07:55 PM
I want to do mass mailing in outlook, from an excel file that has. Franco Excel Discussion (Misc queries) 2 January 25th 05 07:49 AM
E-mailing through Outlook via Excel VB Greg Maloney Excel Programming 1 July 6th 04 02:20 PM
macro for e-mailing excel file using outlook matt Excel Programming 3 July 11th 03 11:54 PM


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