Databases Reference
In-Depth Information
FIGURE 2.5 The directory choice example GUI.
to check the validity of any user-specified paths, and should they not exist, have the macro create
them. A sample application has been created to demonstrate this process. It can be run in Excel
by selecting from the menu ADA -> Chapter 2 -> Browse. When the sample macro is executed
from the menu, the GUI shown in Figure 2.5 will appear.
When the “Choose Directory” button is pushed on the GUI shown in Figure 2.5, a standard
Windows “Browse for Folder” dialog box appears as shown in Figure 2.6.
The code snippet below is what activates the GUI shown in Figure 2.5.
Sub BrowseExample()
'Show the Directory Choosing Example GUI
frmBrowse.Show
End Sub
When the “Choose Directory” button is pushed the following
code is executed from within the form.
Private Sub Browse_Button_Click()
'Utilize the Browse Dialog Box to Return Directory into
TextBox
frmBrowse.Path_TextBox.Text = BrowseForDirectory
End Sub
Notice that it is the BrowseForDirectory function that activates a standard Windows
“Browse for Folder” dialog box and returns the chosen path to the text box on the form. In order
FIGURE 2.6 Standard Windows Browse for Folder dialog box.
Search WWH ::




Custom Search