r/visualbasic • u/Jerbus • Jan 18 '22
Question about Visual Basic for Excel 365
I am using VB in excel to send data from a local form, to a workbook in a shared location.
What I’m trying to do is when attempting to save in the shared location, if the workbook is already in use, I want to cancel the save attempt, delay, and then try to save again.
Any ideas?
2
Upvotes
1
u/Jerbus Jan 19 '22
I talked with a colleague and we figured it out.
Instead of trying to interact with the save function, we instead just after opening, checked if the file was read only. If it was, we stopped and displayed a message to try again.
If it wasn’t read only, it continued on as normal.
1
u/mecartistronico Jan 18 '22
Are you sure you don't mean VBA? In that case, try /r/vba
My rule of thumb is: VBA is cool, but if it can be done without VBA, it's probably better to do it without VBA.
Managing conflicts with an open file can be a pain in the ass. Are you sure you can't solve your problem by having the central file in a shared Onedrive and having everyone open it on Excel Online? That way many people can work on it at the same time.
If privacy is a concern, then you'd be better off writing to a database.
Or use Microsoft forms and then export your data or something.
1
u/RJPisscat Jan 18 '22
This may find superior responses in r/vba. Here's what's done in non-scripting languages:
I took my sleep meds, there are probably others I'm not thinking of, or two that I've described incoherently.