Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default How check if workbook open?

Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some tabs
into the workbook it opens. But sometimes the files that it opens are already
open by another user. In that case, there is an error message and some other
stuff can happen that messes up the program. I would like to stop this, is
there any properties or code that I can do to tell if a file is already open?
I thought of using an On Error stuff, but is there another way?
Thanks again.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How check if workbook open?


You can check if the ReadOnly property of the newly opened workbook is
true. If so, its open with another user.


--
mrice


------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=532753

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default How check if workbook open?

Ian,

Have a look at the links on from the post below:

http://groups.google.co.uk/group/mic...e4 46e41e7314

Best regards

John

"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some tabs
into the workbook it opens. But sometimes the files that it opens are
already
open by another user. In that case, there is an error message and some
other
stuff can happen that messes up the program. I would like to stop this, is
there any properties or code that I can do to tell if a file is already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default How check if workbook open?

Ivan Moala has a solution to checking if a file is open on a network or not,
an API method and a VBA method he
http://www.xcelfiles.com/IsFileOpen.html

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some tabs
into the workbook it opens. But sometimes the files that it opens are
already
open by another user. In that case, there is an error message and some
other
stuff can happen that messes up the program. I would like to stop this, is
there any properties or code that I can do to tell if a file is already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How check if workbook open?

If you don't care about who has the file open, you can modify Ivan's code or
just start out using this simple code (the guts of which is identical to the
approach used by Ivan).


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


"Zack Barresse" wrote:

Ivan Moala has a solution to checking if a file is open on a network or not,
an API method and a VBA method he
http://www.xcelfiles.com/IsFileOpen.html

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some tabs
into the workbook it opens. But sometimes the files that it opens are
already
open by another user. In that case, there is an error message and some
other
stuff can happen that messes up the program. I would like to stop this, is
there any properties or code that I can do to tell if a file is already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default How check if workbook open?

For a local approach, I generally take the easy two-liner..

Function IsWbOpen(wbName as string) as boolean
On error resume next
IsWbOpen = Len(Workbooks(wbName).Name)
End function

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Tom Ogilvy" wrote in message
...
If you don't care about who has the file open, you can modify Ivan's code
or
just start out using this simple code (the guts of which is identical to
the
approach used by Ivan).


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


"Zack Barresse" wrote:

Ivan Moala has a solution to checking if a file is open on a network or
not,
an API method and a VBA method he
http://www.xcelfiles.com/IsFileOpen.html

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some
tabs
into the workbook it opens. But sometimes the files that it opens are
already
open by another user. In that case, there is an error message and some
other
stuff can happen that messes up the program. I would like to stop this,
is
there any properties or code that I can do to tell if a file is already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How check if workbook open?

Neither the OP's question or my suggestion was for a workbook opened in the
same instance of Excel, so I assume this is some added information.

--
Regards,
Tom Ogilvy


"Zack Barresse" wrote in message
...
For a local approach, I generally take the easy two-liner..

Function IsWbOpen(wbName as string) as boolean
On error resume next
IsWbOpen = Len(Workbooks(wbName).Name)
End function

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Tom Ogilvy" wrote in message
...
If you don't care about who has the file open, you can modify Ivan's

code
or
just start out using this simple code (the guts of which is identical to
the
approach used by Ivan).


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


"Zack Barresse" wrote:

Ivan Moala has a solution to checking if a file is open on a network or
not,
an API method and a VBA method he
http://www.xcelfiles.com/IsFileOpen.html

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes some
tabs
into the workbook it opens. But sometimes the files that it opens are
already
open by another user. In that case, there is an error message and

some
other
stuff can happen that messes up the program. I would like to stop

this,
is
there any properties or code that I can do to tell if a file is

already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default How check if workbook open?

You got it. ;)

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Tom Ogilvy" wrote in message
...
Neither the OP's question or my suggestion was for a workbook opened in
the
same instance of Excel, so I assume this is some added information.

--
Regards,
Tom Ogilvy


"Zack Barresse" wrote in message
...
For a local approach, I generally take the easy two-liner..

Function IsWbOpen(wbName as string) as boolean
On error resume next
IsWbOpen = Len(Workbooks(wbName).Name)
End function

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Tom Ogilvy" wrote in message
...
If you don't care about who has the file open, you can modify Ivan's

code
or
just start out using this simple code (the guts of which is identical
to
the
approach used by Ivan).


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


"Zack Barresse" wrote:

Ivan Moala has a solution to checking if a file is open on a network
or
not,
an API method and a VBA method he
http://www.xcelfiles.com/IsFileOpen.html

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"Ian Elliott" wrote in message
...
Thanks for any help.
I have a macro (Excel 2000) in a workbook that copies and pastes
some
tabs
into the workbook it opens. But sometimes the files that it opens
are
already
open by another user. In that case, there is an error message and

some
other
stuff can happen that messes up the program. I would like to stop

this,
is
there any properties or code that I can do to tell if a file is

already
open?
I thought of using an On Error stuff, but is there another way?
Thanks again.










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
VBA to check is someone else has a workbook open Jim K.[_2_] Excel Discussion (Misc queries) 2 August 29th 08 04:32 PM
If Then to check if a workbook is open Shawn Excel Discussion (Misc queries) 5 November 25th 06 04:29 PM
Check if workbook open dkipping Excel Discussion (Misc queries) 4 May 24th 06 02:00 PM
Check for open workbook georgio Excel Programming 2 November 20th 04 11:03 PM


All times are GMT +1. The time now is 04:51 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"