Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to copy 2007 excel file formula results into a 2003 Excel file | Excel Discussion (Misc queries) | |||
double click excel file on the desktop excel opens but not file? | Excel Discussion (Misc queries) | |||
Excel 2003: doubleclick on file opens Excel window, not file. | Excel Discussion (Misc queries) | |||
ExtenXLS loads data into Excel 2002 file but damages the Excel file. | Excel Programming | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) |