Email Macro o send Outlook Email

asivaprakash

New Member
Joined
May 26, 2013
Messages
5
Hi ,

I have completed writing the macro to send an email from excel to mail address.However these are my challenges

1.I want the mail to be reviewed before it is sent but it goes out automatically.

2.Also multiple windows open when the macro is run

I have searched the forum there is none similar.

Any one can help

SP -Please see file below

https://hotfile.com/dl/225330406/4f8030d/email.xlsm.html
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,576
Office Version
  1. 365
Platform
  1. Windows
I have not followed your link - it is much better to just post your code here.

But for (1) if you have:
.send
Change to:
.display
 

asivaprakash

New Member
Joined
May 26, 2013
Messages
5
As Requested

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub SendEMail()
Dim Email As String, Subj As String
Dim Msg As String, URL As String
Dim r As Integer, x As Double
For r = 2 To 4 'data in rows 2-4
' Get the email address
Email = Cells(r, 2)

' Message subject
Subj = "Case#,Order#,$"


' Compose the message
Msg = ""
Msg = Msg & "Hi " & Cells(r, 1) & "," & vbCrLf & vbCrLf
Msg = Msg & "Customer is disputing the charges "


Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf
Msg = Msg & "Sivaprakash A" & vbCrLf
Msg = Msg & "Chargebacks"

' Replace spaces with %20 (hex)
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")

' Replace carriage returns with %0D%0A (hex)
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg


' Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus


' Wait two seconds before sending keystrokes
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
Next r
End Sub
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,576
Office Version
  1. 365
Platform
  1. Windows
For 1.

Try removing this section.
Code:
'       Wait two seconds before sending keystrokes
        Application.Wait (Now + TimeValue("0:00:02"))
        Application.SendKeys "%s"

Out of interest, what email client are you using?
 

Ron de Bruin

Active Member
Joined
Aug 1, 2006
Messages
275
Platform
  1. Windows
  2. MacOS
I have a lot of examples here
Mail from Excel with Outlook (VBA)


Hi ,

I have completed writing the macro to send an email from excel to mail address.However these are my challenges

1.I want the mail to be reviewed before it is sent but it goes out automatically.

2.Also multiple windows open when the macro is run

I have searched the forum there is none similar.

Any one can help

SP -Please see file below

https://hotfile.com/dl/225330406/4f8030d/email.xlsm.html
 

Forum statistics

Threads
1,144,164
Messages
5,722,855
Members
422,461
Latest member
kelleys315

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top