Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Excel File that is Read Only

37 views
Skip to first unread message

Dale Anson

unread,
Oct 14, 2002, 4:01:17 PM10/14/02
to
How do I write a macro that test to see if an Excel
workbook is already openned by another user.

For example: The following statement will open an Excel
workbooked called 'Test.xls', but how to I tell is it is
openned by another user?

Workbooks.Open FileName:="Test.xls"


Harald Staff

unread,
Oct 14, 2002, 5:01:34 PM10/14/02
to
Hi Dale

See if this does what you want:

Sub test()
Dim wbk As Workbook
Set wbk = Workbooks.Open("C:\temp\book1.xls")
If wbk.ReadOnly Then
MsgBox "Write reserved by " & _
wbk.WriteReservedBy
End If
End Sub

HTH. Best wishes Harald

"Dale Anson" <dan...@telec-consulting.com> wrote in message
news:1f5801c273bc$753700a0$36ef2ecf@tkmsftngxa12...

Brian Small

unread,
Oct 14, 2002, 5:06:15 PM10/14/02
to
Dale,

You can use the following VBA statements to test if the active workbook is
read-only.

If ActiveWorkbook.ReadOnly Then
' Execute your code here
End If

Regards,
Brian Small
________________________________


"Dale Anson" <dan...@telec-consulting.com> wrote in message
news:1f5801c273bc$753700a0$36ef2ecf@tkmsftngxa12...

Gareth Roberts

unread,
Oct 14, 2002, 5:16:04 PM10/14/02
to
Hi Dale,

If you open it up ReadOnly you can check the .WriteReservedBy property.

See below link for more details - you'll have to piece it together though.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23DgWdh
NYCHA.2564%40tkmsftngp09&rnum=1&prev=/groups%3Fq%3Dworkbook%2B%2Bopen%2Buser
name%2Bogilvy%2Bgroup:microsoft.public.excel.programming%26num%3D100%26hl%3D
en%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26scoring%3Dd

HTH,
Gareth

"Dale Anson" <dan...@telec-consulting.com> wrote in message
news:1f5801c273bc$753700a0$36ef2ecf@tkmsftngxa12...

0 new messages