Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default No changes during Read-Only mode

The following code runs on a spreadsheet that lots of people access when the
workbook opens. My intention was to be able to see who had the workbook open
for long periods of time. However, what happens when you try to open it and
someone else already has it open, You get the Read Only choice and when you
click that to open, it still puts your UserName. Anyway to do this where it
doesn't update during Read Only mode? Thanks for the help!

Sub Workbook_Open()
ActiveSheet.Unprotect Password:="scbtloan"
Range("B1").Value = Environ("UserName")
Range("C1").Value = Format(Now, "dd mmm yyyy hh:mm:ss")
ActiveSheet.Protect Password:="scbtloan"
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default No changes during Read-Only mode

Before setting the user and time, check the status:
if thisworkbook.readonly = false then
....
end if

"Jasmine" wrote:

The following code runs on a spreadsheet that lots of people access when the
workbook opens. My intention was to be able to see who had the workbook open
for long periods of time. However, what happens when you try to open it and
someone else already has it open, You get the Read Only choice and when you
click that to open, it still puts your UserName. Anyway to do this where it
doesn't update during Read Only mode? Thanks for the help!

Sub Workbook_Open()
ActiveSheet.Unprotect Password:="scbtloan"
Range("B1").Value = Environ("UserName")
Range("C1").Value = Format(Now, "dd mmm yyyy hh:mm:ss")
ActiveSheet.Protect Password:="scbtloan"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default No changes during Read-Only mode

Thank you so much! That worked great!

"bpeltzer" wrote:

Before setting the user and time, check the status:
if thisworkbook.readonly = false then
...
end if

"Jasmine" wrote:

The following code runs on a spreadsheet that lots of people access when the
workbook opens. My intention was to be able to see who had the workbook open
for long periods of time. However, what happens when you try to open it and
someone else already has it open, You get the Read Only choice and when you
click that to open, it still puts your UserName. Anyway to do this where it
doesn't update during Read Only mode? Thanks for the help!

Sub Workbook_Open()
ActiveSheet.Unprotect Password:="scbtloan"
Range("B1").Value = Environ("UserName")
Range("C1").Value = Format(Now, "dd mmm yyyy hh:mm:ss")
ActiveSheet.Protect Password:="scbtloan"
End Sub

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
[Read-Only] [Compatibility Mode] MichaelRobert Setting up and Configuration of Excel 0 March 4th 10 09:53 PM
Read-Only Compatibility Mode MichaelRobert Excel Discussion (Misc queries) 0 March 4th 10 09:17 PM
Read-Only Mode Robin Excel Discussion (Misc queries) 3 January 17th 08 03:45 AM
Office Still Disabled - Read Only Mode Xaos Setting up and Configuration of Excel 1 October 15th 06 06:01 PM
Read only mode Patric[_2_] Excel Programming 1 August 19th 04 02:23 PM


All times are GMT +1. The time now is 06:53 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"