PDA

View Full Version : 'browse' button for vbscript (W2K)



kkw3
04-11-2003, 11:21 AM
Does vbscript have a command that will create a 'browse' button for a user to browse for drives/folders/files?

Jama
04-13-2003, 09:20 AM
Use this vbscript to launch the standard Browse For Folder dialog
Limitations: you can not select files.


'############### Browse For Folder dialog ################
On Error Resume Next
Const BIF_EDITBOX = &H10
Const BIF_NEWDIALOGSTYLE = &H40
Set sa = CreateObject("Shell.Application")
Set oF = sa.BrowseForFolder(0, "My Computer:",_
BIF_EDITBOX Or BIF_NEWDIALOGSTYLE)

oFolder = oF.Items.Item.path
If Err.Number > 0 Then
MsgBox("You have not selected a folder." & vbCrlf &_
"This script will not continue!")
Err.Clear
Else
wscript.echo oFolder
End If

'###################### End #############################

Jama

kkw3
04-16-2003, 12:30 PM
Thanks again!