Hi Experts
I am trying to write some code so that it will loop through all the files in the folder and do certain things is the file name is like...
My Code is
Code
Dim wb as workbook
Dim cmMyPath As String
Dim cmMyFile As String
Dim MyExt As String
Dim file As Variant
Dim fso As Scripting.FileSystemObject
Dim fsopath As Scripting.Folder
MyExt = "*.xlsx"
MyPath = Sheets("Sheet1").Range("I3") '"C:\Users\Owner\Dropbox\Accounts Miqlat\"
cmMyPath = Sheets("Sheet1").Range("I3") & "Maureen\"
MyFile = "Cash Management v1.4.xltx"
cmMyFile = Dir(cmMyPath & MyExt)
Set fsopath = fso.GetFolder(cmMyPath) - 'Error Here "Object Variable or with block variable not set"
For Each file In fsopath.Files
If cmMyFile Like "*Cash Management*" Then
Set wb = Workbooks.Open(Filename:=cmMyPath & cmMyFile)
' DO stuff
' close
End If
Next file
Display More
I am sure I am missing something, but if someone could point the way, I would be grateful.