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: