By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

create listing hyperlinked

P: 6
hi,All

How create a hyperlinked listing of all files in a directory access

thanks
ira borneo
Jun 16 '15 #1
Share this Question
Share on Google+
1 Reply


jforbes
Expert 100+
P: 1,107
I've developed something similar to what you are asking for, but it's probably overkill for what you are wanting to do. So instead of pasting a hundred plus lines of code, here is a quick mockup showing the basics:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3.     Dim oFSO As New FileSystemObject
  4.     Dim sDir As String
  5.     Dim oFolder As Folder
  6.     Dim oFile As Scripting.File
  7.  
  8.     ' Create Folder object specified by what is in the TextBox
  9.     sDir = Nz(Me.txtDirectory.Value, "")
  10.     Set oFolder = oFSO.GetFolder(sDir)
  11.  
  12.     ' Clear the ListBox and populate it from the Files in the Folder
  13.     Me.lstFiles.RowSource = ""
  14.     For Each oFile In oFolder.Files
  15.         Me.lstFiles.AddItem (oFile.Path)
  16.     Next oFile
  17.  
  18. End Sub
  19.  
  20. Private Sub lstFiles_Click()
  21.  
  22.     Dim sFilePath As String
  23.  
  24.    ' Open the Selected File
  25.     sFilePath = Nz(Me.lstFiles.Value, "")
  26.     If Len(sFilePath) > 0 Then FollowHyperlink (sFilePath)
  27.  
  28. End Sub
You'll need to include Microsoft Scripting Runtime as a reference to the Visual Basic project. Also, if you want the links to look like hyperlinks, you can set format of the ListBox to have the text color of blue and underlined.
Jun 16 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.