H
Highlander
Hello all. Consider the following HTA:
<HTML>
<HEAD>
<TITLE></TITLE></HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
Sub ButBrowse_onclick()
'-- show browse window and Get file path:
Dim sFile
sFile = Browse
If (sFile <> "") Then
'--Do something with file....
MsgBox sFile '--For demo
End If
End Sub
Function Browse()
Dim Q2, sRet, IE
On Error Resume Next
Q2 = chr(34)
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
Browse = .value
End With
IE.Quit
Set IE = Nothing
End Function
</SCRIPT>
<INPUT NAME="ButBrowse" TYPE="button" TITLE="Browse to select file."
VALUE="Browse For File"></INPUT><BR>
</BODY></HTML>
I obtained the above script from a previous post:
http://groups.google.com/group/micr...cripting.vbscript&q="Dim+Q2,+sRet,+IE"&qt_g=1
By default the browse for file dialog box opens up to my workstation's
C: drive. I would like the ability to pre-select which drive and folder
the dialog box opens up to. If I run the script from a network drive
for example, I would like the dialog box to open up to that network
drive's current folder. Any suggestions would be greatly appreciated.
Thanks!
- Dave
<HTML>
<HEAD>
<TITLE></TITLE></HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
Sub ButBrowse_onclick()
'-- show browse window and Get file path:
Dim sFile
sFile = Browse
If (sFile <> "") Then
'--Do something with file....
MsgBox sFile '--For demo
End If
End Sub
Function Browse()
Dim Q2, sRet, IE
On Error Resume Next
Q2 = chr(34)
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
Browse = .value
End With
IE.Quit
Set IE = Nothing
End Function
</SCRIPT>
<INPUT NAME="ButBrowse" TYPE="button" TITLE="Browse to select file."
VALUE="Browse For File"></INPUT><BR>
</BODY></HTML>
I obtained the above script from a previous post:
http://groups.google.com/group/micr...cripting.vbscript&q="Dim+Q2,+sRet,+IE"&qt_g=1
By default the browse for file dialog box opens up to my workstation's
C: drive. I would like the ability to pre-select which drive and folder
the dialog box opens up to. If I run the script from a network drive
for example, I would like the dialog box to open up to that network
drive's current folder. Any suggestions would be greatly appreciated.
Thanks!
- Dave