Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change a file from read only back to total access? help New Users to Excel 3 September 23rd 07 03:24 AM
Can you change linked Excel file to Access path with Excel VBA [email protected] Excel Programming 1 June 23rd 07 03:24 PM
How do you change format on Excel .CSV file to import to access Matt Excel Discussion (Misc queries) 1 January 17th 07 11:04 PM
Change Addin File Access to Readonly? Emil Vogel Excel Programming 2 October 24th 06 07:43 AM
Access Form In An Access Report (SubForm) Question Gary Links and Linking in Excel 0 January 27th 06 05:54 AM


All times are GMT +1. The time now is 11:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"