asmja
08-06-2006, 03:33 PM
I have a form on which I have a text box "txtPath" which holds the path to a folder containing internet shortcuts. For example the Favorites folder. On the form I have a list box that has two columns and a command button.
What I need is that when I click on the command button, the list box would be filled with the internet shortcuts file names and URLs.
I've managed to get the file names but I haven't been able to get the URLs. I would appreciate any help
"Label6" is a label that hold the number of items the list box has
"txtextention" is a text box where I could set what file extention I want, in this case it woud be ".url"
here is the code I have behind the command button for now
Private Sub Command0_Click()
Dim FileName As String, i As Integer
'Clear the list box
For i = List1.ListCount - 1 To 0 Step -1
Me.List1.RemoveItem (i)
Next i
'add the list box columns headers
Me.List1.AddItem "Title; URL"
'get the file names of the internet shortcuts and
'add them to the list box
Path = txtPath & "\" & txtextention
FileName = Dir(Path)
Do While FileName <> ""
Me.List1.AddItem FileName
FileName = Dir
Loop
'set Label6 caption property to the number of items in the list box
'the minus 1 part is to account for the first item in the list box
'which would be the columns headers
Label6.Caption = Me.List1.ListCount - 1
End Sub
What I need is that when I click on the command button, the list box would be filled with the internet shortcuts file names and URLs.
I've managed to get the file names but I haven't been able to get the URLs. I would appreciate any help
"Label6" is a label that hold the number of items the list box has
"txtextention" is a text box where I could set what file extention I want, in this case it woud be ".url"
here is the code I have behind the command button for now
Private Sub Command0_Click()
Dim FileName As String, i As Integer
'Clear the list box
For i = List1.ListCount - 1 To 0 Step -1
Me.List1.RemoveItem (i)
Next i
'add the list box columns headers
Me.List1.AddItem "Title; URL"
'get the file names of the internet shortcuts and
'add them to the list box
Path = txtPath & "\" & txtextention
FileName = Dir(Path)
Do While FileName <> ""
Me.List1.AddItem FileName
FileName = Dir
Loop
'set Label6 caption property to the number of items in the list box
'the minus 1 part is to account for the first item in the list box
'which would be the columns headers
Label6.Caption = Me.List1.ListCount - 1
End Sub