#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default SIMPLE ?

Does anyone know how to check within a macro whether a
workbook of name xxxx is currently open. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default SIMPLE ?

Here is one I use as part of a double_click event from a typed name in a
cell. It activates, if open or opens if not.

Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows(workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
End Sub

--
Don Guillett
SalesAid Software

"Wandering Mage" wrote in message
...
Does anyone know how to check within a macro whether a
workbook of name xxxx is currently open. Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default SIMPLE ?

Thanks for the reply. Is there, however, and functions
that just spits out a True/False as to whether or not
given workbook is open?
-----Original Message-----
Here is one I use as part of a double_click event from a

typed name in a
cell. It activates, if open or opens if not.

Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows(workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros

xlAutoOpen
End Sub

--
Don Guillett
SalesAid Software

"Wandering Mage"

wrote in message
...
Does anyone know how to check within a macro whether a
workbook of name xxxx is currently open. Thanks!



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default SIMPLE ?

'-----------------------------------------------------------------
Function IsWbOpen(FileName As String) As Boolean
'-----------------------------------------------------------------
On Error Resume Next
IsWbOpen = CBool(Len(Workbooks(FileName).Name))
End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Wandering Mage" wrote in message
...
Thanks for the reply. Is there, however, and functions
that just spits out a True/False as to whether or not
given workbook is open?
-----Original Message-----
Here is one I use as part of a double_click event from a

typed name in a
cell. It activates, if open or opens if not.

Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows(workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros

xlAutoOpen
End Sub

--
Don Guillett
SalesAid Software

"Wandering Mage"

wrote in message
...
Does anyone know how to check within a macro whether a
workbook of name xxxx 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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Make it more simple or intuitive to do simple things Vernie Charts and Charting in Excel 1 March 16th 05 04:01 AM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"