Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default running vbs script from vba?

I have a vbs script that I'm trying to run from a vba subroutine in excel
using the "shell" function:

cmdstr$ = "cscript w:\simtemp\ctd.vbs"
retval = Shell(cmdstr$, vbMaximizedFocus)

When this executes, the cscript window opens but the script doesn't run.
However when I open a command shell and manually start the script it runs
fine:

Shouldn't this work or am I missing something?

Thanks
John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default running vbs script from vba?

This worked for me in Win98:

Option Explicit
Sub testme()
Dim myScript As String
myScript = "C:\My Documents\scripts\DeleteTempFiles.vbs"
Shell "start " & Chr(34) & myScript & Chr(34), vbMaximizedFocus
End Sub

The extra chr(34) were required since my .vbs path had spaces in it.

I do see a DOS window, though.



John Gunn wrote:

I have a vbs script that I'm trying to run from a vba subroutine in excel
using the "shell" function:

cmdstr$ = "cscript w:\simtemp\ctd.vbs"
retval = Shell(cmdstr$, vbMaximizedFocus)

When this executes, the cscript window opens but the script doesn't run.
However when I open a command shell and manually start the script it runs
fine:

Shouldn't this work or am I missing something?

Thanks
John


--

Dave Peterson
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
question about some excel restriction script running on ... roise_r Excel Discussion (Misc queries) 0 March 30th 06 11:53 AM
question about some excel restriction script running on ... roise_r Excel Discussion (Misc queries) 0 March 30th 06 11:44 AM
Running a script while editing a cell clayton Excel Discussion (Misc queries) 8 December 15th 05 10:24 PM
Compile error when running a vba script. AB Robbins Excel Programming 3 October 14th 04 01:56 PM
Running a VB Script Sofia Katchi Excel Programming 2 July 17th 03 03:22 PM


All times are GMT +1. The time now is 03:03 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"