How do I display external files to a dropdown list?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm attempting to use an unbound control's data source to list (*.docs or
*.mpeg) files from a static path, and once displayed, the AfterUpdate
argument would launch the application based upon the file's extension.
 
To list all the files in a folder into a combo box, copy the code from this
link into a module:
http://members.iinet.net.au/~allenbrowne/func-02.html

Change this line, depending on where your folder is and what fiiles you want
to read:
strFileName = Dir$("C:\MyFolder\*.doc")

Set this property for your combo:
RowSourceType DirListBox

The combo now lists the files of the specified type from the specified
folder.

To automatically launch the application designed to handle docs or mpegs or
whatever, use FollowHyperlink in the AfterUpdate event procedure of the
combo:

Private Sub Combo1_AfterUpdate()
If Not IsNull(Me.Combo1) Then
Application.FollowHyperlink Me.Combo1
End If
End Sub
 
Back
Top