Hello,
I have a Replace.vbs script which does this operation to a text file "Test.txt"
-finds a string "orig_name"
-replaces it with a string "new_name"
I save the Replace.vbs and test.txt in the same directory:
C:\Documents and Settings\tops\My Documents
and from the command line (start-> run-> cmd)
I go to that directory and enter:
csript Replace.vbs "Test.txt" "orig_name" "new_name"
and the program works fine
However when I go try to do this from an Excel VBA, I can't figure out the appropriate syntax. I tried:
Sub TextEditor()
ChDir "C:\Documents and Settings\tops\My Documents"
Shell cscript(Replace.vbs, test.txt, orig_name, new_name)
End Sub
I get an error saying:
Compile Error: Argument not Optional
Does anyone know the appropriate syntax to call a vbs script that needs multiple arguments?
Note I have tried several combinations of ampersands, commas, quotations, etc. and no luck.
Regards,
patstarks
I have a Replace.vbs script which does this operation to a text file "Test.txt"
-finds a string "orig_name"
-replaces it with a string "new_name"
I save the Replace.vbs and test.txt in the same directory:
C:\Documents and Settings\tops\My Documents
and from the command line (start-> run-> cmd)
I go to that directory and enter:
csript Replace.vbs "Test.txt" "orig_name" "new_name"
and the program works fine
However when I go try to do this from an Excel VBA, I can't figure out the appropriate syntax. I tried:
Sub TextEditor()
ChDir "C:\Documents and Settings\tops\My Documents"
Shell cscript(Replace.vbs, test.txt, orig_name, new_name)
End Sub
I get an error saying:
Compile Error: Argument not Optional
Does anyone know the appropriate syntax to call a vbs script that needs multiple arguments?
Note I have tried several combinations of ampersands, commas, quotations, etc. and no luck.
Regards,
patstarks