I'm struggling to think of a reason why I should be getting an 'Access denied' error when trying to save an Excel document opened through a program written in VB 2010 Express.
The program is essentially glorified Excel automation. It converts information from hundreds of Excel documents into a few small text files in order to improve operation speed. The software is designed for use by no more than a dozen or so people in the office who are all editing these Excel documents (through the software), and saving changes. They edit a given document by selecting it in a list in the main form, which then changes the document to writeable and opens it for them. A FileSystemWatcher detects changes in the folder containing the Excel documents so that the aforementioned text files can be updated when the user saves the Excel document.
The problem arises when the software has multiple simultaneous users. If two users are simultaneously editing different Excel documents (it won't allow them to open the same one), the user that opened their Excel document first is able to save, but the other is given the 'Access denied' error. The document can be saved to a different location through Save As.
I suspect this has something to do with accessing the shared text files. In all cases where information needs to be written to these files, the I/O operations are contained within a While loop so that the program continues to try and write to the document until it is available.
A couple of other things of note: first is that if I and my colleague both open the program and, say, he opens an Excel document through the software and THEN I do, he will see a window flash up quickly (too quickly to see whether it has content, or what the content might be), and vice versa. Secondly, after saving (or being denied access), we will both notice our cursors flashing with an egg timer next to it. It seems that the software continues to work on something after we've tried saving, but I can't quite figure it out as an infinite loop would crash the software, but this just causes it to lag.
I know it's a bit of a long shot asking if anyone can help with this because I can't imagine that the exact circumstances are often replicated around the world. There are about a dozen or so long methods involved in this process so I'm not sure what code would be helpful to post and I'm not even sure where the issue is occurring. I should note that I don't receive any error messages from my software, only from Excel, and my software only catches IOExceptions from these methods.
I've tried to make this as concise as possible, but realise that I may well have done a poor job of describing the problem. If you need any further explanation or do require some supporting code, then please let me know. I appreciate any and all help!