|
|
|||
| Code Essentials Printer Friendly Version | |||
|
|
Beginner’s section on how to work in the VBA environment, how to work with functions and expressions – generally not specific to Outlook | ||
| Topic | |||
|
|
File Browse Dialog from Form Script
How to display file choose dialog from form's script? p0s0l 23-Apr-2007 07:16 |
||
|
|
p0s0l
23-Apr-2007 23:58
Or... How to use structured types in VBScript?... (or its not possible?) I have small experience of programming VBScript... |
||
|
|
Sue Mosher
24-Apr-2007 07:09
MSDN has lots of information on VBScript, which doesn't support structured types. It's possible to display a folder browse dialog with the Shell's BrowseFolder method, but I don't know of any equivalent for browsing files. |
||
|
|
p0s0l
25-Apr-2007 23:33
Ok, thanks |
||
|
|
eijaz sheikh
29-Apr-2007 06:24
'******************************************************** Private Const BIF_RETURNONLYFSDIRS As Long = &H1 Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2 Private Const BIF_RETURNFSANCESTORS As Long = &H8 Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000 Private Const BIF_BROWSEFORPRINTER As Long = &H2000 Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000 Private Const MAX_PATH As Long = 260 Sub Select Folder Dim FolNm As String FolNm = BrowseFolder("Select a folder") If FolNm = "" Then MsgBox "You didn't select a folder" Exit Sub Else ' MsgBox "You selected: " & FolNm End If End Sub Function BrowseFolder(Optional Caption As String, _ Optional InitialFolder As String) As String Dim SH As Shell32.Shell Dim F As Shell32.Folder Set SH = New Shell32.Shell Set F = SH.BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder) If Not F Is Nothing Then BrowseFolder = F.Items.Item.Path End If End Function '************************************* Hope this helps! |
||
|
|
eijaz sheikh
29-Apr-2007 06:25
Sorry, its not Sub Select Folder, But Sub SelectFolder......... '******************************************************** Private Const BIF_RETURNONLYFSDIRS As Long = &H1 Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2 Private Const BIF_RETURNFSANCESTORS As Long = &H8 Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000 Private Const BIF_BROWSEFORPRINTER As Long = &H2000 Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000 Private Const MAX_PATH As Long = 260 Sub Select Folder Dim FolNm As String FolNm = BrowseFolder("Select a folder") If FolNm = "" Then MsgBox "You didn't select a folder" Exit Sub Else ' MsgBox "You selected: " & FolNm End If End Sub Function BrowseFolder(Optional Caption As String, _ Optional InitialFolder As String) As String Dim SH As Shell32.Shell Dim F As Shell32.Folder Set SH = New Shell32.Shell Set F = SH.BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder) If Not F Is Nothing Then BrowseFolder = F.Items.Item.Path End If End Function '************************************* Hope this helps! |
||
|
|
Sue Mosher
29-Apr-2007 07:57
Thanks! I knew there was a trick Iwas missing -- BIF_BROWSEINCLUDEFILES |
||
|
|
|||
