![]() |
Run a vbs file from MS-Excel
Using Office 2003 and Windows XP;
I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
Hi,
This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
Thanks for posting, using your suggestion no longer generates an error, but
the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
I tested it with a simple vbs script file that shows a message box and it
worked. Maybe try providing the full path to the script. Or in a command prompt, go to the directory where the script is and type in cscript Myscript.vbs If you try to execute it from the command prompt does it work? I guess you can also try using wscript just in case that makes a difference.. Maybe also check the version of cscript.exe and wscript.exe. I have v5.6 for both. Both files should be in the C:\windows\system32 folder. -- Hope that helps. Vergel Adriano "XP" wrote: Thanks for posting, using your suggestion no longer generates an error, but the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
Vergel,
Thanks again my version of both files is: 5.6.0.8820 I changed it to: Shell "C:\windows\system32\WScript.exe MyPath\MyScript.vbs" As you suggested and now I know what is wrong...there are spaces in MyPath (a variable); the spaces are required as they are at network level; do you know how to get around this? Thanks a lot for your help... "Vergel Adriano" wrote: I tested it with a simple vbs script file that shows a message box and it worked. Maybe try providing the full path to the script. Or in a command prompt, go to the directory where the script is and type in cscript Myscript.vbs If you try to execute it from the command prompt does it work? I guess you can also try using wscript just in case that makes a difference.. Maybe also check the version of cscript.exe and wscript.exe. I have v5.6 for both. Both files should be in the C:\windows\system32 folder. -- Hope that helps. Vergel Adriano "XP" wrote: Thanks for posting, using your suggestion no longer generates an error, but the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
Hi Vergel,
Experimenting with it, this is what finally worked: Shell "WScript " & """MyPath\MyScript.vbs""" Thanks again so much for your assistance; could not have cracked it without your help! "Vergel Adriano" wrote: I tested it with a simple vbs script file that shows a message box and it worked. Maybe try providing the full path to the script. Or in a command prompt, go to the directory where the script is and type in cscript Myscript.vbs If you try to execute it from the command prompt does it work? I guess you can also try using wscript just in case that makes a difference.. Maybe also check the version of cscript.exe and wscript.exe. I have v5.6 for both. Both files should be in the C:\windows\system32 folder. -- Hope that helps. Vergel Adriano "XP" wrote: Thanks for posting, using your suggestion no longer generates an error, but the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
I found that enclosing the path and filename in double quotes works.. This
worked for me Shell "cscript ""C:\a folder with spaces\test.vbs""" So I guess if Mypath is a variable, you'll need to concatenate it with the strings to formulate the cscript command. I think something like this would work for you Shell "cscript """ & MyPath & "\MyScript.vbs""" -- Hope that helps. Vergel Adriano "XP" wrote: Vergel, Thanks again my version of both files is: 5.6.0.8820 I changed it to: Shell "C:\windows\system32\WScript.exe MyPath\MyScript.vbs" As you suggested and now I know what is wrong...there are spaces in MyPath (a variable); the spaces are required as they are at network level; do you know how to get around this? Thanks a lot for your help... "Vergel Adriano" wrote: I tested it with a simple vbs script file that shows a message box and it worked. Maybe try providing the full path to the script. Or in a command prompt, go to the directory where the script is and type in cscript Myscript.vbs If you try to execute it from the command prompt does it work? I guess you can also try using wscript just in case that makes a difference.. Maybe also check the version of cscript.exe and wscript.exe. I have v5.6 for both. Both files should be in the C:\windows\system32 folder. -- Hope that helps. Vergel Adriano "XP" wrote: Thanks for posting, using your suggestion no longer generates an error, but the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
Run a vbs file from MS-Excel
glad to hear you got it to work. :-)
-- Hope that helps. Vergel Adriano "XP" wrote: Hi Vergel, Experimenting with it, this is what finally worked: Shell "WScript " & """MyPath\MyScript.vbs""" Thanks again so much for your assistance; could not have cracked it without your help! "Vergel Adriano" wrote: I tested it with a simple vbs script file that shows a message box and it worked. Maybe try providing the full path to the script. Or in a command prompt, go to the directory where the script is and type in cscript Myscript.vbs If you try to execute it from the command prompt does it work? I guess you can also try using wscript just in case that makes a difference.. Maybe also check the version of cscript.exe and wscript.exe. I have v5.6 for both. Both files should be in the C:\windows\system32 folder. -- Hope that helps. Vergel Adriano "XP" wrote: Thanks for posting, using your suggestion no longer generates an error, but the script fails to execute. I added a message box to first line in the script file and it never fires. Any other ideas? "Vergel Adriano" wrote: Hi, This worked for me. try it this way Shell "cscript MyPath\MyScript.vbs" -- Hope that helps. Vergel Adriano "XP" wrote: Using Office 2003 and Windows XP; I am using the following code line to run a VBScript file: Shell "MyPath\MyScript.vbs" But, I get error: Invalid procedure call or argument Any idea how I can get this to run using Shell? The path and file are correct since I can run it using the hyperlink method, but this produces an undesired unsupressable warning. Thanks in advance. |
All times are GMT +1. The time now is 05:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com