K
K
Hi all, I got macro (see below) which opens up the "Browse Folder"
window and then when I select any Folder from it and press ok it
diplay all kind of files in that folder into the List Box which is on
my sheet. My question is that I created this macro doing search on
this group and i dont know any side effects of this macro (like
failing to produce result or give error in future) so can please any
friend know any simple macro to do the same job or any suggestions or
any other macro to make this job perfect.
Sub GetFiles()
Sheets("Group Emailer").ListBox1.Clear
Dim Filename As String
Dim Foldername As String
Dim objShell
Dim objFolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.browseforfolder(0, "CHOSE FOLDER:", 0, 17)
If (Not objFolder Is Nothing) Then
Foldername = objFolder.self.Path & "\"
Filename = Dir(Foldername)
Do Until Filename = ""
Sheets("Group Emailer").ListBox1.AddItem (Filename)
Filename = Dir
Loop
End If
End Sub
window and then when I select any Folder from it and press ok it
diplay all kind of files in that folder into the List Box which is on
my sheet. My question is that I created this macro doing search on
this group and i dont know any side effects of this macro (like
failing to produce result or give error in future) so can please any
friend know any simple macro to do the same job or any suggestions or
any other macro to make this job perfect.
Sub GetFiles()
Sheets("Group Emailer").ListBox1.Clear
Dim Filename As String
Dim Foldername As String
Dim objShell
Dim objFolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.browseforfolder(0, "CHOSE FOLDER:", 0, 17)
If (Not objFolder Is Nothing) Then
Foldername = objFolder.self.Path & "\"
Filename = Dir(Foldername)
Do Until Filename = ""
Sheets("Group Emailer").ListBox1.AddItem (Filename)
Filename = Dir
Loop
End If
End Sub