Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Open file pop-up (network)

Hello,

The company I work for has a network and when a shared file is open, I
ususally get a pop-up box that asks if I want to open the file as read only,
wait for notificatin that the file is OK to open or cancel. I have written
some code (see attached) and I don't get this box pop-up box letting me know
that the file is already open and this creates file integrity problems if the
file is already open by another user.

I think I want the pop-up box, and I am open to other suggestions. Any
ideas how to write the code?

IsOpen = False
For Each wb In Workbooks 'check thru all open workbooks
If wb.Name = "Master Log.xls" Then 'change to your file's name
IsOpen = True 'your file is already
End If
Next wb
If IsOpen = False Then
Workbooks.Open Filename:="\\Tuc-nas\Master Log\Master Log.xls"
'This opens the other workbook if it was
closed
End If


Thanks,
Cameron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open file pop-up (network)

That only checks if the file is open in the same instance of excel.
Perhaps the more general


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


is what you want.

--
Regards,
Tom Ogilvy

"Cameron" wrote in message
...
Hello,

The company I work for has a network and when a shared file is open, I
ususally get a pop-up box that asks if I want to open the file as read

only,
wait for notificatin that the file is OK to open or cancel. I have

written
some code (see attached) and I don't get this box pop-up box letting me

know
that the file is already open and this creates file integrity problems if

the
file is already open by another user.

I think I want the pop-up box, and I am open to other suggestions. Any
ideas how to write the code?

IsOpen = False
For Each wb In Workbooks 'check thru all open workbooks
If wb.Name = "Master Log.xls" Then 'change to your file's name
IsOpen = True 'your file is already
End If
Next wb
If IsOpen = False Then
Workbooks.Open Filename:="\\Tuc-nas\Master Log\Master Log.xls"
'This opens the other workbook if it was
closed
End If


Thanks,
Cameron



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
XL2007 - Can't open a file that is in use on the network PCLIVE Excel Discussion (Misc queries) 0 February 4th 09 07:30 PM
Excel Silently Crashing when Network file is open Scot McPherson Excel Discussion (Misc queries) 3 January 2nd 08 05:51 PM
Windows API to get network username of person with file open Paul Martin Excel Programming 7 December 2nd 05 04:31 PM
excel does not open file in network Bram Excel Worksheet Functions 0 August 21st 05 07:21 PM
How do I open a file from a Network drive using Excel VBA? turnerje Excel Programming 1 August 2nd 05 10:43 PM


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