Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Open Workbook if not already opened

I am looking for a procedure that opens a workbook if it is not already open.
How do I find out if a workbook is currently open?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Open Workbook if not already opened

The following code should work

Sub isOpen()
On Error GoTo notOpen

Set xlTest = Workbooks("Workbook.xls")
MsgBox "Workbook is open"
Exit Sub

notOpen:
MsgBox "The workbook is NOT open"
Workbooks.Open ("c:\Workbook.xls")

End Sub

Replace the Workbook.xls name with the actual name of your workbook. You'll
also need to specify the path in the Workbooks.Open method in the second to
last line.
--
http://HelpExcel.com
1-888-INGENIO
1-888-464-3646
x0197758


"gottahavit" wrote:

I am looking for a procedure that opens a workbook if it is not already open.
How do I find out if a workbook is currently open?

Thanks.

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
open workbook b when workbook a opened [email protected] uk Excel Discussion (Misc queries) 5 July 23rd 08 01:02 AM
Form to open when workbook is opened Dana Excel Worksheet Functions 2 November 27th 07 12:27 AM
When I open a workbook, another one called Book1 is also opened. W Ian@MarlandLtd Excel Discussion (Misc queries) 2 November 9th 05 09:36 AM
Opening a workbook if not opened, going to it if already opened neotokyo[_2_] Excel Programming 1 September 24th 04 07:17 PM
Opening a workbook if not opened, going to it if already opened neotokyo Excel Programming 1 September 24th 04 06:33 PM


All times are GMT +1. The time now is 10:13 PM.

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"