PC Review


Reply
Thread Tools Rate Thread

Change File Access Question

 
 
Kevin
Guest
Posts: n/a
 
      12th Dec 2008
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 With Quote
 
 
 
 
Kevin
Guest
Posts: n/a
 
      12th Dec 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
change excel file name from access Daniel M Microsoft Access VBA Modules 4 27th Nov 2007 01:14 PM
Change field length in Access 97 file format(Access 2000) =?Utf-8?B?UHJhc2hhbnQ=?= Microsoft Access Database Table Design 5 18th Aug 2007 01:45 PM
How can I use the VBA in Access to change the password of the Access file new.microsoft.com Microsoft Access Macros 1 23rd Dec 2003 01:39 AM
change the icon for a M.Access file john smith Microsoft Access 2 17th Oct 2003 12:19 PM
File/Open question change Terry Microsoft Word Document Management 0 3rd Sep 2003 08:47 PM


Features
 

Advertising
 

Newsgroups
 


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