Change File Access Question

K

Kevin

I have an add-in that I use to house all of my code and several different
spreadsheets that people will open and modify with this add-in.

I also have in the add-in some basic data from each of the seperate
spreadsheets to have quick access to it without opening each of the
spreadsheets.

The issue I just thought of now is if two or more people are using the
add-in at the same time to modify different spreadsheets then how can the
data get updated to the add-in?

I'm playing around with how the ChangeFileAccess works by putting this code
into a test file and opening it in two different sessions to see if I can
open it read only, change it to read write just long enough to change one
thing, save it and have that data updated for the other person who also has
it opend as read only..


This is my test code:

Sub test()
ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite
Range("a1") = Environ("username")
ActiveWorkbook.Save
ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
End Sub

What happens when I run it is it will get to the change to read write and
then will not run the rest of the macro because its getting the latest copy
of the file.

Is there an event that is triggered when this happens I could use to run the
rest of the code?
I have tried Auto_Open and WindowActivate but neither one are triggered when
the file access mode is changed.

Thanks,
Kevin
 
K

Kevin

Although it does seem to work ok if I have a seperate file for the data than
the add-in code. Then the macro is not stopped from the reloading of the
add-in...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top