Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default error number to determine if shared file is open on "this" machine

i've change the way a file is used: it is now shared...
so, this code which had been useful... no longer detects if a file is
currently open on "this" computer

what would the correct error number be?

Select Case errnum
' No error occurred.
' File is NOT already open by another user.
Case 0
IsFileOpen = False
' Error number for "Permission Denied."
' File is already opened by another user.
Case 70
IsFileOpen = True
' Another error occurred.
Case Else
Error errnum
End Select

thanks in advance
mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default error number to determine if shared file is open on "this" machine


you'll need to check workbook.userstatus

try like:

Private Sub Workbook_Open()

Dim vMode
On Error Resume Next
If Me.ReadOnly Then
vMode = 3
Else
vMode = Application.VLookup(Application.UserName, Me.UserStatus, 3)
End If
MsgBox "Mode: " & Choose(vMode, "exclusive", "shared", "readonly")

End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"mark kubicki" wrote:

i've change the way a file is used: it is now shared...
so, this code which had been useful... no longer detects if a file is
currently open on "this" computer

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
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Excel Discussion (Misc queries) 1 June 5th 06 01:15 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Setting up and Configuration of Excel 1 June 5th 06 01:15 PM
error: "invalid character in text conent" How do I open this file RTH Excel Discussion (Misc queries) 5 April 23rd 06 03:04 PM


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