Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change File Access Question
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change File Access Question
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... "Kevin" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change a file from read only back to total access? | New Users to Excel | |||
Can you change linked Excel file to Access path with Excel VBA | Excel Programming | |||
How do you change format on Excel .CSV file to import to access | Excel Discussion (Misc queries) | |||
Change Addin File Access to Readonly? | Excel Programming | |||
Access Form In An Access Report (SubForm) Question | Links and Linking in Excel |