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 !!!!
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 !!!!