VERSION 5.00 Begin VB.Form frmBrowseFolders AutoRedraw = -1 'True BorderStyle = 3 'Fixed Dialog Caption = "Select A Folder" ClientHeight = 3480 ClientLeft = 45 ClientTop = 330 ClientWidth = 2625 LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3480 ScaleWidth = 2625 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdCancel Cancel = -1 'True Caption = "Cancel" Height = 495 Left = 1680 TabIndex = 2 Top = 2880 Width = 735 End Begin VB.CommandButton cmdOkay Caption = "Okay" BeginProperty Font Name = "MS Sans Serif" Size = 13.5 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 240 TabIndex = 1 Top = 2880 Width = 1095 End Begin VB.DirListBox lstFolders Height = 2115 Left = 120 TabIndex = 0 Top = 120 Width = 2295 End Begin VB.DriveListBox lstDrives Height = 315 Left = 120 TabIndex = 3 Top = 2400 Width = 2415 End End Attribute VB_Name = "frmBrowseFolders" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False '************************************************************************************************** ' Opens a modal form to select drive and folder. ' Typically called as below: ' On Local Error Resume Next 'causes error if invalid path. ' frmBrowseFolders.lstFolders.Path = txtPath 'get the path. ' frmBrowseFolders.Show vbModal ' On Local Error GoTo Oops ' If Len(frmBrowseFolders.lstFolders.Path) > 2 Then _ ' txtPath = frmBrowseFolders.lstFolders.Path 'if good, use it. ' Unload frmBrowseFolders ' Oops: 'no can do, ignore. '************************************************************************************************** Option Explicit Private Sub cmdCancel_Click() lstFolders.Tag = "" Hide End Sub Private Sub cmdOkay_Click() lstFolders.Tag = "okay" Hide End Sub Private Sub Form_Load() Left = formMain.Left + formMain.Width / 2 - Width / 2 Top = formMain.Top + formMain.Height / 2 - Height / 2 End Sub Private Sub lstDrives_Change() On Local Error GoTo BadDrive lstFolders.Path = lstDrives.Drive Exit Sub BadDrive: MsgBox ("OOPS! " + Err.Description) End Sub Private Sub lstFolders_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then lstFolders.Path = lstFolders.List(lstFolders.ListIndex) End Sub