Coolpix
Coolpix

Reputation: 513

WScript.Shell.run on multi thread

I would like to know if there is a way to run a shell window on another thread than excel ?

The idea is to not freeze excel when I launch a shell.

for instance :

Dim objShell
Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run "cmd /K CD C:\ & Dir"
Set objShell = Nothing

Thanks for your help

Upvotes: 0

Views: 960

Answers (2)

Storax
Storax

Reputation: 12167

I would agree and disagree with Praktik. I agree because you cannot create a real multi-threaded application in Excel. I disagree because you could use kind of trick to execute another script. Let's assume you have a vbs script called "Script.vbs". Then you could code sth like this taskId = Shell("wscript Script.vbs parms"). The script would run independently from your VBA program. But may that's not what you want.

Upvotes: 1

Pratik Parikh
Pratik Parikh

Reputation: 11

The answer would be NO, you cannot create multi-threaded application in Excel.

However you can use Application.ScreenUpdating = False to lock the current Excel Workbook.

Make sure you enable it back at the end of the code like so Application.ScreenUpdating = True

Hope that helps!

Upvotes: 1

Related Questions