Check to see if an existing workbook is open

Wingz

New Member
Joined
Mar 5, 2002
Messages
33
Can anyone tell me the syntax for code that will check to see whether or not an existing workbook is open?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Here is a code I use
I can't remember who I received it from
but it works great compliments from unknown

Dim wBook As Workbook

Application.ScreenUpdating = True
On Error Resume Next
Set wBook = Workbooks("Barschedulle2.xls")
If wBook Is Nothing Then 'Not open
Set wBook = Nothing
On Error GoTo 0
Else 'It is open

MsgBox "You must close down Barschedulle2 first to continue changes", _
vbInformation, "Caution"
Windows("BarScheduLLE2.xls").Activate
Exit Sub
End If
continue your code here then End sub
Thanks Johny
 
Upvote 0

Forum statistics

Threads
1,214,845
Messages
6,121,902
Members
449,053
Latest member
Guy Boot

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top