View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mark Sasse Mark Sasse is offline
external usenet poster
 
Posts: 1
Default Testing for open workbook

On Sat, 01 Nov 2003 03:43:08 -0500, nigelab wrote:

Hi.

I need to create vba code within a excel macro to detemine if a
workbook is already open. If it is, I want to continue with the macro.
If it isnt, I want to open the workbook and then continue with the
macro.

I am sure this must be pretty easy. I'm just struggling to work out how
to do it.

Can anyone give me some suitable code.

Many thanks in advance.

Nigel



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

I had the same problem last week. I found a simple way depending if you
want only one person in the workbook at the same time.

There is a property on the workbook ReadOnly. If you use this, you can
detect if someone else has taken a lock on the file.

So...

If SomeWorkbook.ReadOnly = True Then
SomeCodeHere
End If

Cheers,

Mark