Hello

Regard below my simple routine to auto email using gbmail. I would
prefer to pass values to the routine instead of hardcoding the
recipients and the message.

This is made difficult by two reasons. First, the Shell function
appears not to accept ANY variables representing the command string.
Such is why I could not use the variable "sString" in the routine. And
second, I had trouble with the double quotes required to change the
subject of the email. The -s parameter requires quotes around the
subject if there are spaces. And since Shell requires quotes around
the command, the double quotes do not work.

Any ideas? I would like to be able to vary the subject and the
recipients by using variables. sSubject would not work because it is a
variable.

Thank you in advance for your help.

wpw3

Sub EmailFriends()

Dim MyPath As String, sString As String, sCurrPath As String
Dim sAddresses As String
Dim sSubject As String, sSMTP As String, sFrom As String
Dim RetVal As Long

sCurrPath = ActiveWorkbook.path
MyPath = "C:\Program Files\gbmail"
sSubject = "Hello My Friends"
sAddresses = "[email protected] [email protected]"
sSMTP = "nycexch01.myserver.com"
sFrom = "[email protected]"

Rem sString = "gbmail -to [email protected]
[email protected] -s Test -h nycexch01.myserver.com -from
[email protected]"

sString = "gbmail -to " & sAddresses & " -s " & sSubject & " -h " &
sSMTP & " -from " & sFrom

RetVal = Shell("c:\Program Files\gbmail\gbmail -to
[email protected] [email protected] -h
nycexch01.myserver.com -s Hello_My_Friends -from [email protected]", 0)

End Sub