i need a code to loop a file and if the file is free for read and write goto Msgbox...
I dont remenber if this coide make tath? in other case need code:-)
Sub TRAPFILE()
Do Until RunUpdateChk = True
DoEvents
Loop
'Inserire qui la macro successiva al controllo della stampa terminata...
MsgBox "Call IMPORT_L0848.epf"
End Sub
Function RunUpdateChk() As Boolean
If IsFileUpdated("C:EPFL0848.EPF") Then
If IsFileLock("C:EPFL0848.EPF", "C:EPFBK") Then
Else
RunUpdateChk = True
End If
End If
End Function
Function IsFileUpdated(strFilePath$) As Boolean
'You must select Tools | References... (in the Visual Basic Editor), locate Microsoft Scripting Runtime in the list, tick its check box and click OK.
Dim fs As New FileSystemObject, fil As file
Set fil = fs.GetFile(strFilePath)
If DateValue(fil.DateCreated) = Date Then IsFileUpdated = True
End Function
Function IsFileLock(strFilePath$, strTmpPath$) As Boolean
Dim fs As New FileSystemObject
Dim fil As file, strTmp$
Set fil = fs.GetFile(strFilePath)
strTmp = fil.Path
On Error Resume Next
fil.Move strTmpPath
If Err <> 0 Then IsFileLock = True
fil.Move strTmp
End Function



