Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Checking if workbook open (where path is unknown)

If bIsBookOpen("abc.xls") Then
MsgBox "FOUND " & "abc.xls"
End If

Public Function bIsBookOpen(ByRef szBookName As String) As Boolean
'' Checks to see whether a WorkBook is open.

On Error Resume Next
bIsBookOpen = (Len(Workbooks(szBookName).Name) 0)

End Function

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

On 4 Sep 2003 14:00:37 -0700, (Alan) wrote:

I need to check if a workbook is open but the user may have changed
the path.

The workbook I want to test for is called abc.xls and contains a
specific customised (password-protected) code. I want to test, from
def.xls, if abc.xls is open. The user may have changed the path (and
even the name) of abc.xls, so I can't check is C:\some path\abc.xls is
open.

How do I do this?

The pseudo code might be:

For each open workbook in any instance of Excel
Check for presence of code
If code found then
msgbox "FOUND"
exit for
Next workbook

I am using Excel 2000.

TIA
Alan


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
How to see full path name of open workbook? Joe User[_2_] Excel Discussion (Misc queries) 5 March 21st 10 08:29 PM
How to find file-path of open workbook? Larryq22 Excel Discussion (Misc queries) 7 January 24th 08 03:38 AM
Macro to open Workbook in default path. Richard Excel Discussion (Misc queries) 2 October 7th 07 02:24 PM
Checking for Open Workbook sbharbour Excel Programming 6 August 28th 03 11:42 PM
checking if workbook is open before accessing David Goodall Excel Programming 1 August 22nd 03 08:43 PM


All times are GMT +1. The time now is 02:16 AM.

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"