Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Deferred Mail(2)

Don

next time hit a REPLY button to stay in original thread,
else i'll never notice.. just pure chance i saw this post.

.Save
.Move .Parent.Session.GetDefaultFolder(16) 'olFolderDrafts
End With
End With



change to:

.Save
If ObjPtr(.Parent.Session.Application.ActiveExplorer) = 0 Then
.Move .Parent.Session.GetDefaultFolder(16) 'olFolderDrafts
End If
End With

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Deferred Mail(2)

I have used your code to help with one of my databases.
Thanks for the info. It creates the draft email with
attachment.

How do you have the code send the email also?

-----Original Message-----
Don

next time hit a REPLY button to stay in original thread,
else i'll never notice.. just pure chance i saw this post.

.Save
.Move .Parent.Session.GetDefaultFolder

(16) 'olFolderDrafts
End With
End With



change to:

.Save
If ObjPtr(.Parent.Session.Application.ActiveExplorer) =

0 Then
.Move .Parent.Session.GetDefaultFolder

(16) 'olFolderDrafts
End If
End With

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Deferred Mail(2)


Tim.. iso .Save and .Move do .Send or .Display so the user can press
the send button.

Tons of info on www.rondebruin.nl


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Tim wrote :

I have used your code to help with one of my databases.
Thanks for the info. It creates the draft email with
attachment.

How do you have the code send the email also?

-----Original Message-----
Don

next time hit a REPLY button to stay in original thread,
else i'll never notice.. just pure chance i saw this post.

.Save
.Move .Parent.Session.GetDefaultFolder

(16) 'olFolderDrafts
End With
End With



change to:

.Save
If ObjPtr(.Parent.Session.Application.ActiveExplorer) =

0 Then
.Move .Parent.Session.GetDefaultFolder

(16) 'olFolderDrafts
End If
End With

--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam





.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Deferred Mail(2)

Cheers and thanks again.
Don

"Don Lloyd" wrote in message
...
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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Deferred Mail(2)


Don ..

we're on our way.. at least we're within the thread <g
next time reply to MY message not your own.
then the system can flag that there is a response to my message and
notify me.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Don Lloyd wrote :

Cheers and thanks again.
Don

"Don Lloyd" wrote in message
...
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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Deferred Mail(2)

Don Lloyd wrote:

Cheers and thanks again.
Don


Don,

What keepITcool doesn't say:
Dump that virus-infested Outlook Express and start using a *real*
newsreader like XanaNews (see www.newsreaders.com for more info)
Outlook Express grows you bad habits.

--
Amedee Van Gasse using XanaNews 1.16.3.1
If it has an "X" in the name, it must be Linux?
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
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 09:00 PM.

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"