dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Web
Expertise: Beginner
Feb 5, 2003

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


VBScript for "ShowOpenDialog"


Ever want to use the Common Dialog "ShowOpenDialog" but were frustrated because it required that Visual Studio be installed on each user's PC?

Here's an alternative written in VBScript that can be used in WSH scripts or ASP pages.

To test, save as "Browse4.vbs" then double-click it.
 
Option Explicit
Const cVBS = "BrowseFor.vbs"

MsgBox BrowseForFolder("File","Browse a File")
MsgBox BrowseForFolder("Folder","Browse a Folder")

Function BrowseForFolder(sBFF,sPMT)
    BrowseForFolder = ""
    If sBFF <> "Folder" And sBFF <> 
"File" Then Exit Function
   '*
    Dim objSHL
    Set objSHL = CreateObject("Shell.Application")
    Dim objB4F
   '*
    On Error Resume Next
    If sBFF = "Folder" Then
        Set objB4F = 
objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
    Else
        Set objB4F = 
objSHL.BrowseForFolder(&H0,sPMT,&H4031,&H0011)
    End If
    BrowseForFolder = 
objB4F.ParentFolder.ParseName(objB4F.Title).Path
    If Err.Number <> 0 Then BrowseForFolder = ""
   '*
    Set objB4F = Nothing
    Set objSHL = Nothing
End Function
Douglas McKirahan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date