Sélection d'un fichier
- Code : Tout sélectionner
Public Function FileSelect(wTitle As String, wDirectoryByDefault As String) As String
'déclaration Variable
Dim vrValue As Variant
Dim Title As String
Dim Directory As String
On Error Goto ErreurHandle
If UIWork Is Nothing Then
Set UIwork = New NotesUIworkSpace
End If
FileSelect = ""
If Trim(wTitle) = "" Then
If DB Is Nothing Or Session Is Nothing Then
Set Session = New NotesSession
Set DB = Session.CUrrentdatabase
End If
Title = " "+Ucase(db.Title)
Else
Title = " "+Trim(wTitle)
End If
Directory = "c:\"
If Trim(wDirectoryByDefault) <> "" Then
If IsValideDirectory(Trim(wDirectoryByDefault)) = True Then
Directory = Trim(wDirectoryByDefault)
End If
End If
vrValue = UIwork.OpenFileDialog(False,Title,,Directory)
Title = ""
Directory = ""
If Testvariant(vrValue) = False Then
Exit Function
End If
FileSelect = Trim(vrValue(0))
vrValue = Null
Exit Function
ErreurHandle:
Msgbox "("+" : "+Cstr(Getthreadinfo(1))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+"."+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
FileSelect = ""
Exit Function
End Function