I created a file for a client that has (among other things) macros to save copies of various sheets as PDF files. The PDFs are saved in a specified folder that is under the folder containing the Excel file.
Everything worked fine until they apparently moved the Excel file to a SharePoint folder, and are accessing it through OneDrive. Now when they try to save the PDF, they get a runtime error 52 (Bad file name or number).
The code checks to see whether the standard filename already exists, and if so, it adds a sequential "Ver00" to the filename. Curiously, I have an error handler in place should an error occur during the filesave operation, but the macro is NOT reaching that error handler. So I'm thinking it's tripping the error 52 when running the Dir command. But why would this crash when the file is on SharePoint, and not when it's on a local drive? I have no experience with SharePoint / OneDrive so I am clueless on how to help. Any suggestions would be appreciated!
By the way, neither the Subdirectory nor the RefText contain any prohibited characters.
The code is:
Bookmarks