• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

read files in zip folder one by one

veronica.mam

New Member
I have a zipped folder of excel files (around 16). I want to process these files using a macro one by one. I used the following code:


Set folderPicker = Application.FileDialog(msoFileDialogFolderPicker)

With folderPicker

.AllowMultiSelect = False

.ButtonName = "Pick Folder"

.Show

End With

sourceFilePath = folderPicker.SelectedItems(1) + ""

filesInSource = Dir(sourceFilePath + "*.zip")

sourceFilePath = sourceFilePath & "tempFolder"

MkDir sourceFilePath


Set oPP = CreateObject("Shell.Application")

For Each fileNameInZip In oPP.Namespace((filesInSource)).items

If LCase(fileNameInZip) Like LCase("*.xls") Then

oPP.Namespace(sourceFilePath).copyHere_

oPP.Namespace(sourceFilePath).items.Item (CStr(fileNameInZip))


But i get an error at "For Each fileNameInZip In oPP.Namespace((filesInSource)).items" stating that Runtime Error 91 : Object Variable or With Block Variable not set"


Please helppppppppp !!!!
 
Back
Top