Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Test if a Workbook is Open

Is there a way to test if a workbook is open anywhere in the network? I
currently have a macro that tests if a workbook is open, but it only works if
it is open on the users computer.

I have a Source Workbook that transfers data to an Archive Workbook. I want
to make sure that someone isn't using the Archive Workbook before I transfer
the data. Is this possible?

Thanks in Advance!
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Test if a Workbook is Open

Hi Ryan

You can check out the MS sites listed in the post below by Tom Ogilvy
they should help you out.

http://groups.google.co.uk/group/mic...06e446e41e7314

Thanks

Steve
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Test if a Workbook is Open


Function IsFileOpen(FileName As String)
Dim iFilenum As Long
Dim iErr As Long

On Error Resume Next
iFilenum = FreeFile()
Open FileName For Input Lock Read As #iFilenum
Close iFilenum
iErr = Err
On Error GoTo 0

Select Case iErr
Case 0: IsFileOpen = False
Case 70: IsFileOpen = True
Case Else: Error iErr
End Select

End Function

Sub test()
If Not IsFileOpen("C:\MyTest\volker2.xls") Then
Workbooks.Open "C:\MyTest\volker2.xls"
End If
End Sub


--
__________________________________
HTH

Bob

"RyanH" wrote in message
...
Is there a way to test if a workbook is open anywhere in the network? I
currently have a macro that tests if a workbook is open, but it only works
if
it is open on the users computer.

I have a Source Workbook that transfers data to an Archive Workbook. I
want
to make sure that someone isn't using the Archive Workbook before I
transfer
the data. Is this possible?

Thanks in Advance!
--
Cheers,
Ryan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Test if a Workbook is Open

Microsoft shares a way to check to see if the file is open he
http://support.microsoft.com?kbid=138621
Microsoft's IsFileOpen function.

RyanH wrote:

Is there a way to test if a workbook is open anywhere in the network? I
currently have a macro that tests if a workbook is open, but it only works if
it is open on the users computer.

I have a Source Workbook that transfers data to an Archive Workbook. I want
to make sure that someone isn't using the Archive Workbook before I transfer
the data. Is this possible?

Thanks in Advance!
--
Cheers,
Ryan


--

Dave Peterson
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
Test if Workbook is already open ? dim Excel Programming 2 January 13th 08 05:02 PM
Test to see if a workbook is open Brettjg Excel Discussion (Misc queries) 1 March 5th 07 09:26 AM
Test for open workbook kartune85[_3_] Excel Programming 3 June 22nd 06 06:54 AM
Test to see if a workbook is open Alex St-Pierre Excel Programming 3 February 17th 05 05:40 PM
Test if a workbook is open already Kieran1028[_17_] Excel Programming 7 November 22nd 04 08:13 PM


All times are GMT +1. The time now is 12:49 PM.

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"