Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Send Outlook Email From Excel With Preview

Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Send Outlook Email From Excel With Preview

Rich,

You need to return an Inspector object. The code below is a bit skimpy (I'd
add a means to check if Outlook was already open etc., but I think the code
will show you what you need to add. You will use .display instead of .Send
but using a Set statement with the GetInspector property will set you up to
edit the message body and then click the Send button.

'------------------------------------

Sub SendEmailTypeBody()
Set olApp = CreateObject("Outlook.Application")
olApp.Session.Logon

Set outMail = olApp.CreateItem(0)

On Error Resume Next

With outMail
.To = "
.Subject = "This is a test"
.Display
End With

Set myInspector = outMail.GetInspector

Set outMail = Nothing
Set olApp = Nothing
End Sub


'------------------------------------

Steve Yandl




"Rich Locus" wrote in message
...
Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Send Outlook Email From Excel With Preview

Rich,

I went back and tested, with and without the inspector and I can send email
either way (by using .display instead of .send) and still edit the body.

Steve


"Steve Yandl" wrote in message
...
Rich,

You need to return an Inspector object. The code below is a bit skimpy
(I'd add a means to check if Outlook was already open etc., but I think
the code will show you what you need to add. You will use .display
instead of .Send but using a Set statement with the GetInspector property
will set you up to edit the message body and then click the Send button.

'------------------------------------

Sub SendEmailTypeBody()
Set olApp = CreateObject("Outlook.Application")
olApp.Session.Logon

Set outMail = olApp.CreateItem(0)

On Error Resume Next

With outMail
.To = "
.Subject = "This is a test"
.Display
End With

Set myInspector = outMail.GetInspector

Set outMail = Nothing
Set olApp = Nothing
End Sub


'------------------------------------

Steve Yandl




"Rich Locus" wrote in message
...
Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Send Outlook Email From Excel With Preview

change the code to display the email and then remove thesed two lines which
is shutting down outlook

Set OutMail = Nothing
Set OutApp = Nothing

the macro will finish and allow you to manually send the email.

"Rich Locus" wrote:

Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Send Outlook Email From Excel With Preview

Joel:
Thanks!! A perfect solution, and not that obvious.
Regards,
Rich Locus
--
Rich Locus
Logicwurks, LLC


"Joel" wrote:

change the code to display the email and then remove thesed two lines which
is shutting down outlook

Set OutMail = Nothing
Set OutApp = Nothing

the macro will finish and allow you to manually send the email.

"Rich Locus" wrote:

Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Outlook Email From Excel With Preview

Very strange, I never have this problem

If you download the second example file from my site, all examples
use display you say that you are nat able to click on send after that ?
http://www.rondebruin.nl/sendmail.htm


--

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




"Rich Locus" wrote in message ...
Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Send Outlook Email From Excel With Preview

Ron: If you Set OutMail = Nothing you know destroyed the mail object and you
won't be able to send the mail. Setting the application to nothing is
probably ok becasue the mail object will launch outlook.

"Ron de Bruin" wrote:

Very strange, I never have this problem

If you download the second example file from my site, all examples
use display you say that you are nat able to click on send after that ?
http://www.rondebruin.nl/sendmail.htm


--

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




"Rich Locus" wrote in message ...
Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Outlook Email From Excel With Preview

Hi Joel

For a manual Send all the code on my site is working OK for me
If Outlook is closed it will send the mail maybe if you open Outlook but it is waiting in the Outbox

If you download the example file do you have different results


--

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




"Joel" wrote in message ...
Ron: If you Set OutMail = Nothing you know destroyed the mail object and you
won't be able to send the mail. Setting the application to nothing is
probably ok becasue the mail object will launch outlook.

"Ron de Bruin" wrote:

Very strange, I never have this problem

If you download the second example file from my site, all examples
use display you say that you are nat able to click on send after that ?
http://www.rondebruin.nl/sendmail.htm


--

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




"Rich Locus" wrote in message ...
Forum Members:
I can send an email from Excel with attachments through Outlook, but I'm
trying to PREVIEW the email, change it, and then click "SEND".

The .Display option only displays
The .Send option only sends without the chance of a review

Is there a way to preview, approve, then send?

Here's the SUB I'm using:

Sub SendWithAtt(strWorkBookPath As String)

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 = Worksheets("Master").Cells(104, 1).Value
.CC = ""
.BCC = ""
.Subject = "Charge Back On Products Received"
.Body = "SLW Credit Dept: Put Explanation Here"
.Attachments.Add strWorkBookPath
.Send (I can change to .Display, But It Won't Allow a Send After
Review)
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

--
Rich Locus
Logicwurks, LLC


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
Send an email from Excel using Outlook Marcin Peciak Excel Programming 3 May 28th 09 06:25 PM
Send unattended email from Outlook using Excel macro PJ Excel Programming 3 March 11th 09 09:38 PM
how to remove the outlook confirm window when use excel to send email from outlook? Tom Cai Excel Programming 3 March 4th 09 03:35 AM
How to send a single page email from excel 2000 using outlook xp vols2812 Excel Worksheet Functions 1 December 30th 06 06:45 PM
***** PLEASE HELP **** Send an email from Excel to outlook with an automatic macro SAM SEBAIHI Excel Discussion (Misc queries) 0 November 11th 06 08:17 AM


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