> I am curious. How does one "toggle" a workbook that is in read-write
> mode into read-only mode?
[quoted text clipped - 100 lines]
> > > > > > Any suggestions as to how I can get this procedure to NOT run continuously
> > > > > > and still actually work?? Thank you.
Interesting. As you may suspect, I had searched both XL and VBA help
for 'readonly' and 'toggle readonly' before posting.
So, it appears the OP has four choices -- other than the current one.
1) Do nothing if the readonly status is toggled by the user. That
person is explicitly opening the file as readonly or toggling it into
readonly status and then has a 'read only' indicator in the caption.
2) If the change (or opening of the file) is done programmatically,
that would provide the OP with the perfect opportunity to add the
desired watermark to the file. Of course, by doing so, a 'readonly'
file has been modified.
3) Use a OnTime routine that runs every so often and checks the status
of the workbook. If readonly add the desired watermark -- of course,
that will cause the book to be marked as 'changed.'
4) Hook the 'Toggle readonly' button to custom code possibly with a
technique along the lines of 'Hooking command bar control events" (pp.
237-?) in Professional Excel Development by Bullen, Bovey, and Green
(http://www.amazon.com/exec/obidos/ASIN/0321262506/tusharmehtaco-
20/103-9755819-5239853).

Signature
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
> ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
> ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite, Notify:=True
[quoted text clipped - 107 lines]
> > > > > > > Any suggestions as to how I can get this procedure to NOT run continuously
> > > > > > > and still actually work?? Thank you.
nathan - 19 Jan 2006 17:13 GMT
I think the key to this is to find the right combination of conditional code
that will only change the background when it needs to be changed, instead of
continuously setting it (the setting of it is what boggs down the workbook).
i.e. the procedure checks the read-only status, if it is already in
read-only and the read-only background is already set, don't set it again.
If it is not already set, then set it.
I can't come up with the right statemens to do this. Thanks for all your
help.
> Interesting. As you may suspect, I had searched both XL and VBA help
> for 'readonly' and 'toggle readonly' before posting.
[quoted text clipped - 131 lines]
> > > > > > > > Any suggestions as to how I can get this procedure to NOT run continuously
> > > > > > > > and still actually work?? Thank you.
nathan - 19 Jan 2006 20:40 GMT
Turns out the answer is to put the code in the worksheet object event
"worksheet_calculate". Then the necessary procedures, that exist outside of
this procedure, can be called...unlike a Function procedure.
> Interesting. As you may suspect, I had searched both XL and VBA help
> for 'readonly' and 'toggle readonly' before posting.
[quoted text clipped - 131 lines]
> > > > > > > > Any suggestions as to how I can get this procedure to NOT run continuously
> > > > > > > > and still actually work?? Thank you.