Excel 2002; VBA macro; problem with mailto, blind copy and carbon copy
Posted on 2002-05-31
with the help of the following code I try to lauch my e-mail client.
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 Mail(eMail As String, Optional Subject As String, _
Optional Body As String, Optional cc As String, Optional bc As
Call ShellExecute(0&, "Open", "mailto:" + eMail + _
"?Subject=" + Subject + "&Body=" + Body, cc + "CC", bc + "BC",1)
Private Sub CommandButton1_Click()
Dim C As Range
Dim eMail$, Subject$, Body$
Dim Rw%, Cl%
eMail = "firstname.lastname@example.org"
Subject = "Excel-Datei"
Set C = Range("A1:A5")
cc = "email@example.com"
bc = "firstname.lastname@example.org"
Call Mail(eMail, Subject, Body, cc, bc)
Unfortunately this code does not work properly.
My e-mail client is launched, but the created e-mail has neither a carbon copy nor a blind copy.
Can you please tell me how I can fix this problem?
Please note that I don't want a MS Outlook specific solution.