Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass variables as arguments of a function Excel-craze Excel Worksheet Functions 1 August 12th 09 11:48 AM
Defining Variables that pass to other Subs JasonSelf[_14_] Excel Programming 2 August 11th 04 08:57 PM
can variables pass values Don[_11_] Excel Programming 3 November 1st 03 04:50 PM
Pass Variables into Form's code Stuart[_5_] Excel Programming 3 August 23rd 03 04:55 AM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"