Dir for Excel 2011 for the Mac

Hi all

Like a lot of other things in VBA in Office 2011 Dir is not working the same as in Windows.

Together with a great Apple Scripter DJ Bazzie Wazzie I create a VBA function that you can use instead. You can download a file from my site so you can test it.

http://www.rondebruin.nl/mac.htm#Loop

You call the function with one line of code :

Call GetFilesOnMacWithOrWithoutSubfolders(Level:=1, ExtChoice:=0, FileFilterOption:=0, FileNameFilterStr:=”SearchString”)

‘Level : 1= Only the files in the folder, 2 to ? levels of subfolders

‘ExtChoice : 0=(xls|xlsx|xlsm|xlsb), 1=xls , 2=xlsx, 3=xlsm, 4=xlsb, 5=csv, 6=txt, 7=all files, 8=(xlsx|xlsm|xlsb), 9=(csv|txt)

‘FileFilterOption : 0=No Filter, 1=Begins, 2=Ends, 3=Contains

‘FileNameFilterStr : Search string used when FileFilterOption = 1, 2 or 3

 

You can add also more extensions or replace it for word extensions or so.

Thanks, feedback good or bad is welcome

 

 

Posted in VBA


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.