Browsing To

To display a folder location or file location you use the combobox control.
By changing the "DropButtonStyle" to fmDropButtonStyleEllipsis we can create a control that resembles a filename box.

You can then hook the DropButtonClick event.

Private Sub cboFileName_DropButtonClick() 
   Dim vFileName As Variant

'get the filename
'write it to the control
   Me.cboFileName.Text = vFileName

'toggle the enabled property to move the focus to the next control
   Me.cboFileName.Enabled = False
   Me.cboFileName.Enabled = True
End Sub

One annoying aspect of hooking the DropButtonClick event is that we can't cancel it so the control shows an empty list after we have obtained the filename.
One workaround it to toggle the Enabled property of the control which forces the focus to move to the next control in the tab order.

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext