From: Ian Elliott on
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.

From: mrice on

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?action=getinfo&userid=10931
View this thread: http://www.excelforum.com/showthread.php?threadid=532753

From: John on
Ian,

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

http://groups.google.co.uk/group/microsoft.public.excel.programming/browse_thread/thread/f0303fbc54889aa6/6d06e446e41e7314?lnk=st&q=excel+vba+check+if+workbook+is+being+editted+by+another+user&rnum=1#6d06e446e41e7314

Best regards

John

"Ian Elliott" <IanElliott(a)discussions.microsoft.com> wrote in message
news:2EF287FA-BB99-4E7B-BF63-59BE5F7B7250(a)microsoft.com...
> 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.
>


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

HTH

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


"Ian Elliott" <IanElliott(a)discussions.microsoft.com> wrote in message
news:2EF287FA-BB99-4E7B-BF63-59BE5F7B7250(a)microsoft.com...
> 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.
>


From: Tom Ogilvy on
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 here:
> http://www.xcelfiles.com/IsFileOpen.html
>
> HTH
>
> --
> Regards,
> Zack Barresse, aka firefytr
> To email, remove NOSPAM
>
>
> "Ian Elliott" <IanElliott(a)discussions.microsoft.com> wrote in message
> news:2EF287FA-BB99-4E7B-BF63-59BE5F7B7250(a)microsoft.com...
> > 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.
> >
>
>
>
 |  Next  |  Last
Pages: 1 2
Prev: Excel sorting in VBScript
Next: MMult and MInv