473,385 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WScript.Shell, with hidden window

Hello,
I'm using VBA from Excel to call a python script with some arguments. The python script returns only true or false, which is the information I want to take back into Excel.

I'm wondering, is there a way to "hide" the command prompt which pops up in this case? The python script takes 0.5-1 second to execute, and I'm doing a lot of checks with this, meaning I get alot of windows open. Can I use the objShell.Run command without losing the StdOut possibility?

Some code:
com = "C:\python\python.exe pythonscript.py " & arg1 & " " & arg2
Set objShell = CreateObject("WScript.Shell")

Set objExecObject = objShell.Exec("%comspec% /c " & com)
ok = objExecObject.StdOut.ReadAll()
Mar 27 '08 #1
1 14814
Well, after poking around and trying different solutions, it seems that the way to go is to use objShell.Run, and use a temporary file for storing the output. I did find a good discussion at another forum here, with a useful function fShellRun, that does the trick. Credits to the original poster.
Mar 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kyle | last post by:
To any who chose to provide an answer, or even any suggestions to this problem, I thank you greatly in advance. +200 pts. for any valid solutions. I am currently in the process of converting a...
4
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell...
2
by: Marcin Zmyslowski | last post by:
Hello all! I have installed MSDE on my local computer - Windows 2000 Professional. I have created a function which runs me a link whose path is placed in the input field. This function looks...
2
by: bbxrider | last post by:
for win2k adv server/iis5.0 trying to run an external program from my asp routine that has multiple parameters, see following set shell = server.createobject("wscript.shell") shell.Run...
6
by: MacKenzie | last post by:
The statement in an asp page: dim objShell Set objShell = WScript.CreateObject("WScript.Shell") now gives this error: VB err= 424,Object required If I use...
2
by: rcmail14872 | last post by:
I have seen some very general suggestions for alternative code to the WScript.Shell code, but nothing specific. In the two lines of code below (I think) the first line creates a text file on the...
2
by: Mike John | last post by:
I am trying to use the shell object to send keys to the explorer browser to run the send page funcion. I am receiving the above error only when I put my html file in the web server...
4
by: Kevin Mansel via .NET 247 | last post by:
Ok, basically this is my problem. I'm building a console app tocall a dos program. So i'm using the Shell command to call theprogram, now depending on what happens, I want to read theoutput that...
2
by: =?Utf-8?B?VG9kZA==?= | last post by:
Hello I'm using the following script to try and ping: <% Response.Buffer = true %> <% url = "www.espn.com" Set objWShell = CreateObject("WScript.Shell") Set objCmd = objWShell.Exec("ping " &...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.