Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy 2007 excel file formula results into a 2003 Excel file Nuria Alba de Luz Excel Discussion (Misc queries) 2 July 10th 09 01:48 PM
double click excel file on the desktop excel opens but not file? JPT4266 Excel Discussion (Misc queries) 3 May 7th 09 04:24 PM
Excel 2003: doubleclick on file opens Excel window, not file. Silvy Excel Discussion (Misc queries) 2 June 29th 06 12:15 PM
ExtenXLS loads data into Excel 2002 file but damages the Excel file. [email protected] Excel Programming 1 April 28th 06 09:37 PM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"