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 Mail(2)

Hi KeepITcool,

Thank you, not only for your reply to my previous post, but also for the
time and effort put into providing two fully coded solutions
With reference to your comments, I'm sorry if I appeared not be appreciate
assistance received from the group - this was not intentional.
I do, however, recall that in my initial post I paid tribute to Ron de
Bruin's and Dick Kusleika's sites, from where I gleaned the initial code and
that I thanked you for the 'snippet' of code that you provided.
If you can bear with me for a while longer, I do have a couple of notes
regarding the code, which is reproduced below.

Sub DeferredMail_Short()
Dim Fname, Sbjct
ActiveSheet.Copy
Fname = "C:\MailTemp\" & "TempMail.xls"
If Dir(Fname) < "" Then Kill Fname
ActiveWorkbook.SaveAs Fname
ActiveWorkbook.Close False
Sbjct = "Just Testing Short"
With CreateObject("Outlook.Application")
With .CreateItem(0) 'olMailItem
.To = "
.Subject = Sbjct
. Body = "Notes:"
. Attachments.Add Fname
.Save
. Move .Parent.Session.GetDefaultFolder(16) 'olFolderDrafts
End With
End With
Kill Fname
End Sub

If Outlook is NOT open this works fine eotherwise it fails on line
.Move.Parent.Sessi . . . . .
I'm including the above in case someone else may be tempted to use it as
is - hands up those who haven't 'poached' code from a post!

Sub DeferredMail_Long()
Dim Fname, Sbjct
Dim olApp As Outlook.Application
Dim olFld As Outlook.MAPIFolder
Dim olMsg As Outlook.MailItem
ActiveSheet.Copy
Fname = "C:\MailTemp\" & "TempMail.xls"
If Dir(Fname) < "" Then Kill Fname
ActiveWorkbook.SaveAs Fname
ActiveWorkbook.Close False
Sbjct = "Just Testing Long"
Set olApp = New Outlook.Application
Set olFld = olApp.Session.GetDefaultFolder(olFolderDrafts)
Set olMsg = olApp.CreateItem(olMailItem)
With olMsg
.To = "
.Subject = Sbjct
.Body = "Notes:"
.Attachments.Add Fname
.Save
End With
Kill Fname
Set olMsg = Nothing
Set olFld = Nothing
Set olApp = Nothing
End Sub

This has worked fine whether Outlook is open or not. Thank you.
All I need to do now is to convert it to late binding.

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
Financial function - calculating loans with deferred payments Paul 022 Excel Worksheet Functions 3 April 9th 23 12:52 PM
deferred revenue apat Excel Discussion (Misc queries) 0 April 29th 09 08:18 PM
Error: cannot load the mail service. Check your mail installation. Brad Bowser Excel Discussion (Misc queries) 0 December 20th 05 10:03 PM
General mail failure when sending e-mail from Excel Adrienne Excel Discussion (Misc queries) 5 November 4th 05 12:59 PM
Deferred Mailing from Outlook Don Lloyd Excel Programming 1 July 29th 04 01:13 PM


All times are GMT +1. The time now is 12:18 AM.

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

About Us

"It's about Microsoft Excel"