Hi everyone, my first post (please be gentle!) (Edit - Managed to solve it, in a moment of madness I listened to a colleague and put an "on error resume next" in - I'll not make that mistake again! Apologies for missing the code tags, I'll be better prepared next time!)
I've put together a userform which copies the details entered to another workbook (it opens that workbook, copies the data in, saves and closes it). This and the associated macro all work fine, but I wanted to add some additional protection in because the external file will be updated by multiple users.
I found some code and managed to get a loop working to open the file, and try again if it was read only (code below);
This test sub does what I want it to (there's probably a better way of doing it, but I'm not particularly advanced with VBA). If the file opens and is read only, it brings up the message box and then tries again when the user clicks OK. It keeps doing this until the file is no longer read only.
My problem is when I incorporate that code in to the macro that does everything else, it doesn't behave as I expect it to. It recognises that the external file is read only, but on clicking OK it doesn't loop, it just closes the workbook from which the macro was run. I'm hoping that it's something simple that I'm missing causing this behaviour, so I've put the other macro below.
If anyone can point out where I've gone wrong I'd appreciate it. Thanks in advance
Bookmarks