Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: BrowseForFolder in Category Windows : Common Dialogs from Total Visual SourceBook

Launch the Windows Browse for Folder dialog to select an existing folder and/or create a new folder in VB6 and VBA with 32 and 64 bit Windows API calls.

For VBA, the modFileDialogVBA includes a VBA_FileDialog_GetFolder function which avoids the use of Windows API calls and is simpler to use though it has fewer features.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modBrowseForFolder module
BrowseForFolder Procedure Prompts the user for the location of an existing folder (directory) but does not support a starting folder
BrowseForFolderWithDefault Procedure Prompts the user for the location of an existing directory. Uses call back routine to support the selection of an initial folder.
BrowseCallbackProc64 Procedure Callback routine for the folder browser dialog to support the selection of an initial folder (64-bit version)
BrowseCallbackProc Procedure Callback routine for the folder browser dialog to support the selection of an initial folder (32-bit version)
AddrOfPointer64 Procedure Callback routine to return the value of an AddressOf operator because it can't be assigned directly (64-bit version)
AddrOfPointer Procedure Callback routine to return the value of an AddressOf operator because it can't be assigned directly (32-bit version)
GetFilePath Procedure Get the path part of a string that represents a file. Does not work if the string is a folder.
IsFolder Procedure Determine if a folder exists as specified from a drive letter (e.g. C:\Folder). This procedure is identical to DirectoryExists, but provided if you prefer to use Folder rather than Directory.

Example Code for Using Module: BrowseForFolder

' Example of modBrowseForFolder
'
' To use this example, create a new module and paste this code into it.
' Then run the procedure by putting the cursor in the procedure and pressing:
'    F5 to run it, or
'    F8 to step through it line-by-line (see the Debug menu for more options)

Private Sub Example_modBrowseForFolder()
  ' Comments: Example of using the modBrowseForFolder module to launch the Windows Browse for Folder dialog to select
  '           an existing folder and/or create a new folder in VB6 and VBA with 32 and 64 bit Windows API calls.

  Dim strFolder As String

  ' Select an existing folder
  strFolder = BrowseForFolder(0, "Select an existing folder")
  MsgBox "Selected existing folder: " & strFolder

  ' Select a folder with option to create a new one
  strFolder = BrowseForFolder(0, "Select an existing folder or create a new one", True)
  MsgBox "Selected an existing or new folder: " & strFolder

  ' Select an existing folder defaulting to the previously selected folder, but not create a new one
  strFolder = BrowseForFolderWithDefault(0, "Select a folder starting with a specified folder", False, strFolder)
  MsgBox "Selected existing folder with previously selected folder as the default: " & strFolder

  ' Select an existing folder defaulting to the previously selected folder and allow creating a new one
  strFolder = BrowseForFolderWithDefault(0, "Select a folder starting with a specified folder", True, strFolder)
  MsgBox "Selected existing or new folder with previously selected folder as the default: " & strFolder

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources