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.


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



Posting code or formulas in your comment? Use [cc] tags!

  • [cc_vb]Block of code goes here[/cc_vb]
  • [cci_vb]Inline code goes here[/cci_vb]
  • [cc]Formula goes here[/cc]

Leave a Reply