Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I've run into an unforseen hiccup in my code. I want to test if a workbook is already open so that I don't try to open it again! In one area I open a workbook called 3.xls using buttons in my main book called 73.xls. I want to use a statement, so that if 3.xls is already open, I won't execute the code Workbooks.Open section. I'm sure its a simple IF THEN ELSE, but with my effort below I'm getting an "Invalid or Unqualifed Reference" error on the first line when I try to re-execute the code with 3.xls already open. I received no error when 3.xls was not open. I dont have to use an IF statement, one it works I'll be happy.... Thanks Private Sub CommandButton6_Click() Application.ScreenUpdating = False UserForm4.Hide If Workbooks("3.xls") = .Open Then Windows("73.xls").Activate Sheets("CurrentEmployees").Select Application.ScreenUpdating = True Else Workbooks.Open Filename:= _ "C:\Program Files\systems\MyProgram\Data1\3.xls" Windows("73.xls").Activate Sheets("CurrentEmployees").Select Application.ScreenUpdating = True End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Test to see if a workbook is open | Excel Discussion (Misc queries) | |||
Test to see if a workbook is open | Excel Programming | |||
Test if a workbook is open already | Excel Programming | |||
Test that a workbook is open | Excel Programming | |||
test for workbook open | Excel Programming |