finishing a send email macro

slickwilly84015

New Member
Joined
Dec 14, 2012
Messages
2
i have found this macro to complete a spreadsheet that i am working on but am missing the correct command to automatically send the email with no human intervention the enlarged .send at the end is where it fails everytime what is the correct command?:

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

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim lngResponse As Long
Dim URL As String, strEmail As String, strSubject As String
If Left(Target.Address, 2) = "$D" Then
If Target.Value < Range("$E" & Right(Target.Address, 2)).Value Then
strEmail = Range("$H" & Right(Target.Address, 2)).Value
strSubject = "Buy/Sell Alert" & Range("$F" & Right(Target.Address, 2)).Value & " '" & Range("$B" & Right(Target.Address, 2)).Value & "' items"
strSubject =
Application.WorksheetFunction.Substitute(strSubject, " ", "%20")
strURL = "mailto:" & strEmail & "?subject=" & strSubject
ShellExecute 0&, vbNullString, strURL, vbNullString, vbNullString, vbNormalFocus
End If
.send
End If
End Sub
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
sorry more info I am using excel 2007, and mozilla thunder bird as mail client when ran without the .send command work fine ,but I have to manually hit send button.
 
Upvote 0

Forum statistics

Threads
1,215,981
Messages
6,128,084
Members
449,418
Latest member
arm56

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
Back
Top