Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim objFSO As Object
Dim objFolder As Object
Dim objSubFolder As Object
Dim fil As File
With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing FromPath
.Show
FromPath = .SelectedItems(1) & "\"
End With
With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing ToPath
.Show
ToPath = .SelectedItems(1) & "\"
End With
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FromPath)
For Each objSubFolder In objFolder.SubFolders
**Set fils = fsoC.GetFolder(objSubFolder & "\").Files**
For Each fil In fils
If LCase(Right(fil.Name, 3)) = "zip" Then
MsgBox "this is a zip file "
Else
I'm getting object required error in the marked row , and I do not understand why ? Can anyone help me please ?
objSubFolder
is an object, but you need a string, tryfsoC.GetFolder(objSubFolder.PATH & "\").Files
fils
seems to be not declared, maybe that would help (As Object
orAs Files
)fsoC
is not declared.