Re: Create a browse button on web page by Steve
Steve
Mon Feb 21 17:11:03 CST 2005
Same error message: Permission Denied on this line:
Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
Is there a way to run a stand-alone script when you click on the Browse
button and return the value (path) to the web page? The script works on it's
own, just not in IE.
"McKirahan" wrote:
> "Steve" <Steve@discussions.microsoft.com> wrote in message
> news:E953A234-B264-4B5A-8C89-AAEAF4CAE551@microsoft.com...
> > Sorry about the other posts, this is the only one I can see for some
> reason.
> >
> > I'm trying to give the user the option to browse to a folder and bring
> back
> > the folder path into a text box so they don't have to type it in manually.
> >
> > I guess it doesn't need to be in the form of a web page, but it's the only
> > thing I could come up with that is "free". There are a lot of other input
> > items on the page that the user needs to be able to choose from before
> > clicking "submit".
>
> [snip]
>
> Try this "as-is"; watch for word-wrap.
>
> <html>
> <head>
> <title>BFF.htm</title>
> <script type="text/vbscript">
> Sub BrowseForFolder(sBFF,sPMT)
> Dim objSHL
> Set objSHL = CreateObject("Shell.Application")
> Dim objBFF
> '*
> 'On Error Resume Next
> If sBFF = "Folder" Then
> Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H0031,&H0011)
> document.formBFF.Folder.value =
> objBFF.ParentFolder.ParseName(objBFF.Title).Path
> Else
> Set objBFF = objSHL.BrowseForFolder(&H0,sPMT,&H4031,&H0011)
> document.formBFF.File.value =
> objBFF.ParentFolder.ParseName(objBFF.Title).Path
> End If
> '*
> Set objBFF = Nothing
> Set objSHL = Nothing
> End Sub
> </script>
> <style type="text/css">
> body { font-family:Arial; font-size:9pt }
> td { font-family:Arial; font-size:8pt }
> th { font-family:Arial; font-size:8pt; font-weight:bold }
> </style
> </head>
> <body>
> <center>
> <form name="formBFF">
> <input type="button" value=" Browse For File "
> onclick="Call BrowseForFolder('File','Browse for a File')">
> <input type="text" name="File" size="50">
> <br>
> <input type="button" value="Browse For Folder"
> onclick="Call BrowseForFolder('Folder','Browse for a Folder')">
> <input type="text" name="Folder" size="50">
> </form>
> </center>
> </body>
> </html>
>
> This works for me because I have Visual Studio installed.
>
>
>