ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine if a workbook is already open (https://www.excelbanter.com/excel-programming/342487-determine-if-workbook-already-open.html)

[email protected]

Determine if a workbook is already open
 
Using VBA in open Excel workbook I want to determine if a specific workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through all the
open excel applications that are running and interrogate them to see if one
matches the name that I am concened about...

Thanks in advance for any ideas.



Tom Ogilvy

Determine if a workbook is already open
 
There is no provision for iterating through instances of excel. If you just
want to know if the file is open at all, you can determine that, but not by
iterating instances. If you want to work with the open file in an unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific

workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through all

the
open excel applications that are running and interrogate them to see if

one
matches the name that I am concened about...

Thanks in advance for any ideas.





[email protected]

Determine if a workbook is already open
 
THanks for the quick response

Ok, can you give me an example code snippet of "...know if the file is open
at all"

"Tom Ogilvy" wrote:

There is no provision for iterating through instances of excel. If you just
want to know if the file is open at all, you can determine that, but not by
iterating instances. If you want to work with the open file in an unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific

workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through all

the
open excel applications that are running and interrogate them to see if

one
matches the name that I am concened about...

Thanks in advance for any ideas.






Tom Ogilvy

Determine if a workbook is already open
 

http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

--
Regards,
Tom Ogilvy


" wrote in
message ...
THanks for the quick response

Ok, can you give me an example code snippet of "...know if the file is

open
at all"

"Tom Ogilvy" wrote:

There is no provision for iterating through instances of excel. If you

just
want to know if the file is open at all, you can determine that, but not

by
iterating instances. If you want to work with the open file in an

unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific

workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through

all
the
open excel applications that are running and interrogate them to see

if
one
matches the name that I am concened about...

Thanks in advance for any ideas.








[email protected]

Determine if a workbook is already open
 
Many thanks for the help

"Tom Ogilvy" wrote:


http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

--
Regards,
Tom Ogilvy


" wrote in
message ...
THanks for the quick response

Ok, can you give me an example code snippet of "...know if the file is

open
at all"

"Tom Ogilvy" wrote:

There is no provision for iterating through instances of excel. If you

just
want to know if the file is open at all, you can determine that, but not

by
iterating instances. If you want to work with the open file in an

unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific
workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through

all
the
open excel applications that are running and interrogate them to see

if
one
matches the name that I am concened about...

Thanks in advance for any ideas.









Mats Samson

Determine if a workbook is already open
 
Hi,
I don't know if you already solved the matter but anyhow,
I use the following to check if the WB is open:

Sub OpenMyBook()
Dim bk As Workbook
On Error Resume Next
Set bk = Workbooks("MyBook1.xls")
On Error GoTo 0
If Not bk Is Nothing Then
Workbooks("MyBook1").Activate
Else
ChDir ("Path")
Workbooks.Open ("MyBook1.xls")
End If
Workbooks("MyBook1").Activate
End Sub

Best regards
Mats

" wrote:

Many thanks for the help

"Tom Ogilvy" wrote:


http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

--
Regards,
Tom Ogilvy


" wrote in
message ...
THanks for the quick response

Ok, can you give me an example code snippet of "...know if the file is

open
at all"

"Tom Ogilvy" wrote:

There is no provision for iterating through instances of excel. If you

just
want to know if the file is open at all, you can determine that, but not

by
iterating instances. If you want to work with the open file in an

unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific
workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through

all
the
open excel applications that are running and interrogate them to see

if
one
matches the name that I am concened about...

Thanks in advance for any ideas.









Jac Tremblay[_4_]

Determine if a workbook is already open
 
Hi Tom,

This post and your reply answered my question and solved my problem.

Thank you.
--
Jac Tremblay


"Tom Ogilvy" wrote:


http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

--
Regards,
Tom Ogilvy


" wrote in
message ...
THanks for the quick response

Ok, can you give me an example code snippet of "...know if the file is

open
at all"

"Tom Ogilvy" wrote:

There is no provision for iterating through instances of excel. If you

just
want to know if the file is open at all, you can determine that, but not

by
iterating instances. If you want to work with the open file in an

unknown
instance, there is no provision for it.

--
Regards,
Tom Ogilvy

" wrote in
message ...
Using VBA in open Excel workbook I want to determine if a specific
workbook
is already open. The complication is that multiple Excel processes may
already be open. What's the easiest way to do this?

I suppose what I'm really looking for is some way to iterate through

all
the
open excel applications that are running and interrogate them to see

if
one
matches the name that I am concened about...

Thanks in advance for any ideas.










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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com