From: Wayne Simacek on
In VBA is can do the following:

TempFileName = OpenDlg.FileName.

Is there any equivalent in VBScript?


From: mayayana on
This method is a little bit hokey, but I think
it works on all systems:

Public Function ChooseFile()
On Error Resume Next
Dim Q2, sRet
Q2 = chr(34)
ChooseFile = ""
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = False
IE.Navigate("about:blank")
Do Until IE.ReadyState = 4
Loop

IE.Document.Write "<HTML><BODY><INPUT ID=" & Q2 & "Fil" & Q2 & "Type=" &
Q2 & "file" & Q2 & "></BODY></HTML>"
With IE.Document.all.Fil
.focus
.click
sRet = .value
End With
IE.Quit
Set IE = Nothing
ChooseFile = sRet
End Function

--
--
Wayne Simacek <WJSimacek(a)mchsi.com> wrote in message
news:MAnoe.18831$nG6.17864(a)attbi_s22...
> In VBA is can do the following:
>
> TempFileName = OpenDlg.FileName.
>
> Is there any equivalent in VBScript?
>
>


From: de Graff on
'Better to use the built-in dialog

Set FilePick = CreateObject("UserAccounts.CommonDialog")
FilePick.Filter = "VBScripts|*.vbs|Text Documents|*.txt|All Files|*.*"
FilePick.FilterIndex = 3 'set the third pair (all files) as the default
filter
FilePick.InitialDir = "c:\"

result = FilePick.ShowOpen

If result = False Then
Wscript.Echo "you didn't select a file"
Else
Wscript.Echo "You selected file",result.FileName
end if


From: tlavedas@hotmail_DOT_com on
This is 'built-in' only in XP or later.

Tom Lavedas
===========

de Graff wrote:
> 'Better to use the built-in dialog
>
> Set FilePick = CreateObject("UserAccounts.CommonDialog")
> FilePick.Filter = "VBScripts|*.vbs|Text Documents|*.txt|All Files|*.*"
> FilePick.FilterIndex = 3 'set the third pair (all files) as the default
> filter
> FilePick.InitialDir = "c:\"
>
> result = FilePick.ShowOpen
>
> If result = False Then
> Wscript.Echo "you didn't select a file"
> Else
> Wscript.Echo "You selected file",result.FileName
> end if

From: Joe Earnest on
Hi Tom,

[snipped]

"tlavedas(a)hotmail_DOT_com" <tlavedas(a)hotmail.com> wrote in message
news:1118063176.908851.183530(a)g44g2000cwa.googlegroups.com...
> This is 'built-in' only in XP or later.
>
> Tom Lavedas
> ===========

Just for information, apparently XP only - not "or later".

Joe Earnest