Browse from VBScript


 Something very simple yet complicated is trying to get a browse dialog using vbs.
So here is a snippet that will help in adding a Browse dialog like in the pic , instead of a message box asking for the absolute/relative path of the folder:

Const EDITBOX = &H10
Const DIALOGSTYLE = &H40
Set objShell = CreateObject("Shell.Application")
Set objFolder= objShell.BrowseForFolder(0, "My Computer:",EDITBOX Or DIALOGSTYLE)

Browse = objFolder.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 Browse
End If

Hope this helps!

Comments

  1. Hi,

    The site is about vbscript, you can create your own vbscript solutions to perform simple data transforms.The major cause of this is javascript, vbscript and activex. Thanks a lot.

    ReplyDelete

Post a Comment

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?