It's an embedded macro that saves a report to the same PDF name going to the same location.
What doesn't work is if the user still has the file open and therefore can not be replaced.
I don't really like the counter idea either.
Excuse me ahead of time, but this will be a bit blunt. Welcome to that land sitting between "rock" and "hard place." Your design essentially GUARANTEES a lock collision based on simple probabilities and a potentially irate user who will be bothered by the fact that you took over his session in Acrobat (or whatever) while s/he was still reading a file.
If this sounds harsh, please understand that we don't hide things from you. If you have a code flaw, we tell you. If you have a design flaw, we tell you that. USUALLY, what we describe along the "flawed design" front is a table problem or query problem. But here, it is a procedural problem.
To fix this, you get to make a choice. Either learn to live with file sequence numbers or learn to live with irate users asking why you blew away a copy of a file they were still using or learn to live with program traps.
Before you think I have nothing but criticism, let me add that there is potentially a way around this by judiciously pre-testing your environment to check for pitfalls.
First, you can test whether the file exists using the File System Object to attempt to look up some proerty of the file in question. If no such file exists, you are free and clear to run the PDF creator.
If the file exists, you must then check whether the file is open using a function that you could call before attempting the save.
This link below, a few posts into the thread, contains the "IsFileOpen()" function that can tell you if the file is open. Then at least you can do something to intercept any errors that might come up.
https://stackoverflow.com/questions...leopen-and-outputtext-over-a-simple-save-with
Note that the IsFileOpen function is not intrinsic code from a system or utility library. You have to define it in a module before you can use it. You can find some discussion on-line for the web search "VBA is file open" and can see some errors that crop up if you use this approach.
Do not confuse this approach with the "IsOpen" function that works for web pages. Not the same thing and not guaranteed to work in the context you are describing.