Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
gp gp is offline
external usenet poster
 
Posts: 2
Default Identify if another user has spreadsheet open - in VBA

I would like to run a vba routine if a particular workbook
is not currently in use by someone else. I cannot find
any function ore code that will identify if the book is in
use or not.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Identify if another user has spreadsheet open - in VBA

Hi

You have to open it by code. From there, if it's Readonly then someone else has its
exclusive rights. Or, if you are lucky, the WriteReservedBy property will return the
username of this exclusive user.

I believe that a faster and safer solution is to have a small macro in that particular
book that logs to an available textfile or whatever when and who is opening/closing it.
Then you don't have to touch the file to find this information.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"gp" wrote in message
...
I would like to run a vba routine if a particular workbook
is not currently in use by someone else. I cannot find
any function ore code that will identify if the book is in
use or not.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Identify if another user has spreadsheet open - in VBA

Harald wrote:
You have to open it by code.<<snip


Not necessarily, you could place code on ThisWorkbook code page...

Private Sub Workbook_Open()
If ActiveWorkbook.ReadOnly = False Then 'Means workbook is not read only
'<call your code/function/sub here
End if
End Sub

regards
ricky
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Identify if another user has spreadsheet open - in VBA

"Ricky M. Medley" wrote in message
...

You have to open it by code.<<snip


Not necessarily, you could place code on ThisWorkbook code page...


Well yes, sorry. You could of course open it manually and then have some code running. You
could even open it manually, read the prompt "This file is in use by Harry Callahan. Do
you want to open it Readonly ? Do you feel lucky today ?" and then type "Harry has it"
into a Word macro. Point is, you have to actually open the file to get any information.
And the lady said VBA. But you're right.

Best wishes Harald
Followup to newsgroup only please.



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 can I compare two seperate spreadsheet files to identify diff Bob H Excel Discussion (Misc queries) 1 October 7th 09 12:32 AM
Please help: identify where an automatic link to other spreadsheet is? Lee Harris Excel Worksheet Functions 5 August 19th 06 01:06 AM
identify duplicate data in excel spreadsheet Mandeep Dhami Excel Discussion (Misc queries) 3 July 16th 05 01:53 PM
How do I identify dulicate rows in a spreadsheet? Spyder Excel Discussion (Misc queries) 1 April 27th 05 11:53 PM
How to open another Excel spreadsheet to copy data into current spreadsheet ? Ricky Pang Excel Programming 0 July 13th 03 01:59 PM


All times are GMT +1. The time now is 06:41 AM.

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"