|
-
September 20th, 2001, 10:42 AM
#1
Open File Check
Is there a way or function that indicate if a file is open.
Thanks
Thanks
Hisham
Thank You, Hisham
-
September 20th, 2001, 10:47 AM
#2
Re: Open File Check
dim intFreeFile as Integer
intFreeFile = FreeFile
On Error Resume Next
Open "c:\MyPath\Myfile" For Binary Access Read Write Lock Read Write As intFreeFile
If Err.Number <> 0 Then
MsgBox "File Is Busy"
End If
Close (intFreeFile)
On Error GoTo 0
'=====another example=========
Public Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
dim testfile as string
testfile = "\\server1\c\myapp\reading.flg"
If (GetFileAttributes(testfile) = &HFFFFFFFF) Then
Open fname$ For Output As #1
Print #1,"R"
Close #1
<<code here to open the file>>
Else
MsgBox "Someone is reading the file"
End If
-- end code --
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|