Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass variables value to Shell
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 = " sSMTP = "nycexch01.myserver.com" sFrom = " Rem sString = "gbmail -to -s Test -h nycexch01.myserver.com -from " sString = "gbmail -to " & sAddresses & " -s " & sSubject & " -h " & sSMTP & " -from " & sFrom RetVal = Shell("c:\Program Files\gbmail\gbmail -to -h nycexch01.myserver.com -s Hello_My_Friends -from ", 0) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to pass variables as arguments of a function | Excel Worksheet Functions | |||
Defining Variables that pass to other Subs | Excel Programming | |||
can variables pass values | Excel Programming | |||
Pass Variables into Form's code | Excel Programming |