As the title says, I'm trying to return a list of all files in a specific folder. (I am trying to build something that will automatically generate a monthly statement for each of my clients.) I'm programming this to work on my MacBook. Since Excel 2016 for Mac doesn't have any VBA editing capability to speak of, I am using Windows Excel for programming and Mac Excel for running.
So basically I am using MacScript("") to run a shell script which returns the items I want. (Many thanks to RondeBruin for his awesome website)
OK so when I run the script, if I use MacScript("choose folder as string"), everything works properly as it should. However, if I set the desired destination in manually, it does not work. I output the strings of both methods to a cell and confirmed that the strings containing the pathnames are exactly the same.
Here's where it gets weird: Let's say I have SpreadsheetA which uses MacScript("choose folder as string") to set the file path, and SpreadsheetB which uses VBA to set the filepath. I open SpreadsheetA and SpreadsheetB. I run the script in SpreadsheetB and it does not work. Now I run the script in SpreadsheetA and select the filepath and it works. If I run SpreadsheetB at this point, SpreadsheetB will work flawlessly until I close and restart Excel! This is what has me dumbfounded.
Anyway, here is my code: (I've tried to trim out the extra stuff)
Bookmarks