Hi!
I have a worksheet with e-mail addresses. Now, I am going to use those addresses like a mailing list. But, I have a problem with my code below;
Sub mailto_Selection()
Dim Email As String, Subj As String, cell As Range
Dim response As Variant
Dim msg As String, url As String
Email = "" 'create list below
Subj = "Family Newsletter"
msg = "Dear Family,"
'-- Create the URL
For Each cell In Selection
Email = Email & cell.Text & "; "
Next cell
url = "mailto:" & Email & "?subject=" & Subj & "&body=" _
& Replace(msg, Chr(10), "/" & vbCrLf & "\")
MsgBox url
url = Left(url, 2025) 'was successful with 2025 , not with 2045
'-- Execute the URL (start the email client)
ShellExecute 0&, vbNullString, url, vbNullString, vbNullString, vbNormalFocus
End Sub
The problem is that row "ShellExecute...."causes error; "Sub or function not defined" and the code stopped here. It seems to be that code cannot open my Outlook application.
Anybody have an idea to solve this?
-JK
I have a worksheet with e-mail addresses. Now, I am going to use those addresses like a mailing list. But, I have a problem with my code below;
Sub mailto_Selection()
Dim Email As String, Subj As String, cell As Range
Dim response As Variant
Dim msg As String, url As String
Email = "" 'create list below
Subj = "Family Newsletter"
msg = "Dear Family,"
'-- Create the URL
For Each cell In Selection
Email = Email & cell.Text & "; "
Next cell
url = "mailto:" & Email & "?subject=" & Subj & "&body=" _
& Replace(msg, Chr(10), "/" & vbCrLf & "\")
MsgBox url
url = Left(url, 2025) 'was successful with 2025 , not with 2045
'-- Execute the URL (start the email client)
ShellExecute 0&, vbNullString, url, vbNullString, vbNullString, vbNormalFocus
End Sub
The problem is that row "ShellExecute...."causes error; "Sub or function not defined" and the code stopped here. It seems to be that code cannot open my Outlook application.
Anybody have an idea to solve this?
-JK