Tutorials: Using the Shell Object

Introduction
This presents some example usages of the Shell Object.

Launching Applications
This little snipped will launch notepad when the button has clicked the object ' /// ' Note that for these types of actions it's good practice ' to put them in the mouse up even instead of the ' mouse down event so the user can cancel the action ' by moving the cursor away from the object before ' releasing the mouse button. Also, if the object ' is movable you want to make sure that the user didn't ' intend to move the object. ' ///

Function Object_OnLButtonUp(x, y, Dragged) If Not Dragged Then 'Make sure the object wasn't moved Dim objShell Set objShell = CreateObject("WScript.Shell") objShell.Run "notepad.exe" End If End Function

Batch commands
Similarly, you can use this method to create a batch execution of applications or commands Function Object_OnLButtonUp(x, y, Dragged) If Not Dragged Then 'Make sure the object wasn't moved Dim objShell Set objShell = CreateObject("WScript.Shell") objShell.Run "notepad.exe" objShell.Run "calc.exe" objShell.Run "charmap.exe" End If End Function