Shared workbook - updating data before action
I have shared workbook in excel, so multiple users can change content. Sheet works as list of projects and tasks, which user can insert, edit and delete. Edit and delete works fine for multiple users, but i have issue with inserting. When two (or more users) insert new project/tasks (new rows appears) after save, there is huge conflict in whos data should be saved.
So i have an idea, that before each insertion i would like to load other user changes. Will be enough to use this line before each row insertion?
Application.CommandBars("Reviewing").Controls("&Update File").Execute
(i googled, that this line should trigger shared sheet update)
Or is here better aproach? Maybe after new line save sheet, etc?
So i made bit of testing and when i use
Application.CommandBars("Reviewing").Controls("&Update File").Execute
or
Application.CommandBars.FindControl(ID:=455).Execute
changes wasnt refreshed correctly. Then i accidentaly found solution using basic saving (ALT + S) which have only issue which was prompting information about "Other user made change in excel.."
This lead to my correct solution, where im using
ActiveWorkbook.Save
on macro start and at the end. On macro start because i need actual data from all users which have saved changes, so i get first empty row to which i can safely insert data and at the end so my change is saved for another users.
This also provides data refresh, when user edits previous data. Hope this will help someone in similar issue.