(Solved) – Declare VBScript inside of VBScript (Running multiple .VBS at a time)

  • by
(solved)-–-declare-vbscript-inside-of-vbscript-(running-multiple.vbs-at-a-time)

I need to run multiple .vbs at a time. This is the only way I was able to find online:

Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "1.vbs"
objShell.Run "2.vbs"
objShell.Run "3.vbs"
Set objShell = Nothing

To do that I’d have create 1.vbs, 2.vbs and 3.vbs separately. Is there a way to input them all as part of one .vbs file? Something like

Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")

    Dim vbs1 as vbscript
    Dim vbs2 as vbscript
    Dim vbs3 as vbscript

    Set vbs1 =

    "Set objExcel = CreateObject("Excel.Application")
    objExcel.Application.Run "'C:Userstest1.xlsm'!Module1.refresh"
    objExcel.DisplayAlerts = False
    objExcel.Application.Quit
    Set objExcel = Nothing"

    Set vbs2 = ' whatever code
    Set vbs3 = ' whatever code

objShell.Run vbs1 
objShell.Run vbs2 
objShell.Run vbs3 
Set objShell = Nothing

Leave a Reply

Your email address will not be published. Required fields are marked *