I have the following code in a VBS file; it displays a file open dialog box
and returns the full path to the file chosen. The program should then open
the selected file, but I get an error that the file was not found; how can it
not be found if I just picked it?
The error occurs on the last line, char 1:
Set oDialog = CreateObject("UserAccounts.CommonDialog")
oDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*"
oDialog.FilterIndex = 2
iResult = oDialog.ShowOpen
If iResult = 0 Then
Wscript.Quit
Else
sTarget = oDialog.FileName
'Wscript.Echo sTarget
End If
Set oWSHShell = CreateObject("WScript.Shell")
oWSHShell.Run sTarget, 3, True