Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using parameters

Status
Not open for further replies.

omegabeta

Programmer
Aug 20, 2003
148
RO

I need to transmit the name of a file corresponding to the current day to .run command. I've tried something like this but it doesn't work:

MyFile="c:\ftp2303.txt"
oShell.run "cmd /k TYPE MyFile ",5

Can someone give me an advice ?
Thanks.
 
oShell.run "cmd /k TYPE MyFile ",5

you have enclosed your variable, MyFile in quotation marks, therefore it is not recognised as a variable but simply a string

so
OShell.Run "cmd /k TYPE " & MyFile, 5

should do it.
it might help you to build a string to start off wiht
s2Run = "cmd /k TYPE " & MyFile
Msgbox s2Run
oShell.run s2Run, 5

use this until you get better at scripting.
you should avoid it when you get better as you are creating a variable which isnt really required, other than to help with debugging, and will use up more memory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top