You can't combine my solution with Carl's.
Using Filesystemobject to loop through the files will return each file as an object (file object to be precise). The function I gave you requried the file as a string. I gave you the macro at the bottom that uses VBA's dir() function which loops through files in a folder but returns the files as a string. This is the one you need to use, or you need to change use the .path/.name properties of the file to get the filename as string. That will address your byref mismatch issue.
In essence the two methods for doing this are:
or
Note: the second method is similar to what Carl did but with late binding so it does not need the reference to the filesystemobject.
Bookmarks