-
-
Save AlexLaforge/c06133e9dd8270f59e9af39ce4d26816 to your computer and use it in GitHub Desktop.
Browse for file dialog box in VBScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function BrowseForFile() | |
'@description: Browse for file dialog. | |
'@author: Jeremy England (SimplyCoded) | |
BrowseForFile = CreateObject("WScript.Shell").Exec( _ | |
"mshta.exe ""about:<input type=file id=f>" & _ | |
"<script>resizeTo(0,0);f.click();new ActiveXObject('Scripting.FileSystemObject')" & _ | |
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _ | |
).StdOut.ReadLine() | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filePath = BrowseForFile() | |
If filePath = "" Then | |
MsgBox "Operation canceled", vbcritical | |
Else | |
MsgBox filePath, vbinformation | |
End If | |
'-------------------------------------------------------------------------------------- | |
Function BrowseForFile() | |
'@description: Browse for file dialog. | |
'@author: Jeremy England (SimplyCoded) | |
BrowseForFile = CreateObject("WScript.Shell").Exec( _ | |
"mshta.exe ""about:<input type=file id=f>" & _ | |
"<script>resizeTo(0,0);f.click();new ActiveXObject('Scripting.FileSystemObject')" & _ | |
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _ | |
).StdOut.ReadLine() | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment