VB Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
On Error GoTo No_Bugs
With cdlRun
.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNPathMustExist
.CancelError = True
.Filter = "VB Script files only (*.vbs)|*.vbs"
.DialogTitle = "Select a script to run"
.ShowOpen
End With
ShellExecute Me.hwnd, "OPEN", "C:\Winnt\System32\cmd.exe", " /C " & cdlRun.FileName, "C:\", SW_SHOWNORMAL
Exit Sub
No_Bugs:
MsgBox "Operation canceled by user!',vbokonly+vbexclamation"
End Sub