Uh, no, Josh, that's not correct
The Shell function RETURNS a double, which is the TaskId of the Program it executes. The first (and only required) argument is a STRING, which is the path of the program you want to execute.
The problem (I think) with the string concatenation in D12Bit's post is that he didn't put any spaces between the switches.
Where did you get that information???
Quote:
Normally, the Shell function does not admit any space or parameter in the command line.
That is news to me. Where did you get this info?
I have used the shell function to register and unregister ocx's, which DOES accept spaces (there is a space between regsvr32 and the name of the ocx you want to register/unregister) AND switches (you need to use the "/u" switch to unregister).
Example:
Code:
Option Explicit
' Command1 Unregisters aniglass, and Command2 registers it again. This works fine.
Private Sub Command1_Click()
Shell "regsvr32 /u aniglass.ocx"
End Sub
Private Sub Command2_Click()
Shell "regsvr32 aniglass.ocx"
End Sub
What the Shell function really does...
In case you were wondering, the shell function acts like the "Run" dialog box (Start/Run...). Whatever you have in quotes as an argument to shell will work the same as if you typed it into the "Run" dialog. Try it out and see.
If you want to shell an application, just type the name of the app (Shell "notepad.exe"). If you want to open up a specific file, for example "temp.txt" you put a space between the application that opens it and the file name (Shell "notepad.exe C:\Windows\Desktop\temp.txt").
This works the same if you type it into the Run dialog box.
Just thought that was interesting, and that if you can make your mail program work on the Run command line, you should be able to type the same text into the Shell command and get the same results.
Re: Where did you get that information???
[QUOTE]Originally posted by seaweed
That is news to me. Where did you get this info?
I didn¡¯t get that info anywhere. I have got it from experience. Create a Word document file in a long directory and try something like the following and you¡¯ll see:
Shell "c:\Program Files\Microsoft Office\Office\Winword.exe C:\Program Files\Outlook Express\HelpVb.doc",vbMaximizedFocus
vs.
Shell "c:\Program Files\Microsoft Office\Office\Winword.exe " & Chr$(34) & "C:\Program Files\Outlook Express\HelpVb.doc" & Chr$(34), vbMaximizedFocus
And for your specific case I suggest a code like this ¨C I haven¡¯t tried it for I don¡¯t have an email app as you have:
Code (Note the space following .exe AND I don't know how to use the line end continuing character in such a long command OR even whether it is proper.):
---------------------------------------------------
Shell "g:\digisend\digi\clemail\clemai.exe " & Chr$(34) & "-quiet -smtpserver *********" -from Digital Sender -subject txtnameofodoc.Text -body Attached is a file from the digital sender application -attach g:\q\ txtcboquery.Text -to txtemail.Text¡± & Chr$(34)
---------------------------------------------------
Good luck.
If you still cannot manage with this, I have no other way out either.