Joined: Sat Oct 23, 2004 1:51 pm Posts: 4329 Location: PA
I have VBA code in Excel 2003 that I need to get to work in Excel 2007. Can anyone help? The bolded line is the problem since 2007 doesn't support Application.FileSearch. The workarounds didn't work for me. I assume it's a simple fix.
Sub GetAllExcelFiles() Dim sFolder As String Dim lCounter As Long
sFolder = "M:\Thumb Drive\Scorecards"
With Application.FileSearch .NewSearch .LookIn = sFolder .FileType = msoFileTypeExcelWorkbooks .SearchSubFolders = True 'Set to false or exclude if you don't want subfolders .Execute End With
For lCounter = 1 To Application.FileSearch.FoundFiles.Count Call MyRoutine(Application.FileSearch.FoundFiles(lCounter)) Next lCounter End Sub
_________________
emanon wrote:
I think I either need to drink less to become more alert, or more so as not to care.
Users browsing this forum: No registered users and 10 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum