pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Getting Runtime Error 424. Object requried. msg. Please help.
I am trying to loop through files in folder.
I am trying to loop through files in folder.
Code:
[/FONT]
[FONT=monospace][COLOR=#000080]Sub LoopThruDirectory()
Dim strPath As String
Dim strFile As String
Dim x As Integer[/COLOR][FONT=monospace][FONT=monospace][COLOR=#000080] [/COLOR][/FONT][/FONT][/FONT]
[FONT=monospace][FONT=monospace][FONT=monospace][COLOR=#000080] strPath = "C:\myfolder\"
strFile = Dir(strPath)
Do While strFile <> ""
x = x + 1
[COLOR=black][U]Sheet1.Cells(x, 1) = strFile
[/U][/COLOR] strFile = Dir[/COLOR][/FONT][/FONT][/FONT]
[FONT=monospace][FONT=monospace][FONT=monospace][COLOR=#000080] Loop
End Sub[/COLOR][/FONT][/FONT][/FONT]
[FONT=monospace][FONT=monospace][FONT=monospace][COLOR=#000080][/COLOR][/FONT][/FONT][/FONT][FONT=Courier New]