Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File being used error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

Hi,

When opening a file for writing
or reading, I sometimes get an
error stating that the file is
being used by another application.
So, before I try to do stuff with
that file, is it possible to detect
whether that file is being used or not?
Or is there some error handling code
I should know about and use?

PS.. I've tried
Code:
On Error Resume Next

Thank you.
 
Code:
Dim lngErr as Long
Dim strDescription as string
Dim intResult as Integer
Do
    On Error Resume next
        Open
        lngErr = Err.Number
        strDescription = Err.Description
    On error go to 0
    if lngErr = 0 then exit Do
    intResult = Msgbox ("Error Code=" & lngErr & _
           vbcrlf & strDesription & vbCrlf &
           "Contiune?",vbYesNo)
    if intResult = vbNO then
    ....throw error
    End if
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top