Test si Lotus Ouvert en vba
Bonjour,
Comment faire pour savoir si mon lotus est déjà ouvert ?
Du style :
if lotus.isopen = 1 then
msgbox "ouvert"
else
msgbox "fermé"
merci d'avance
Test si Lotus Ouvert en vba
Inscrire dans un module access :
[VBA]
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Function FileLocked(strFileName As String) As Boolean
On Error Resume Next
' If the file is already opened by another process,
' and the specified type of access is not allowed,
' the Open operation fails and an error occurs.
Open strFileName For Binary Access Read Write Lock Read Write As #1
Close #1
' If an error occurs, the document is currently open.
If Err.Number <> 0 Then
' Display the error number and description.
'MsgBox "Error #" & Str(Err.Number) & " - " & Err.Description
FileLocked = True
Err.Clear
End If
End Function |
[VBA]
Dans la procédure d'appel :
[VBA]
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| Dim strFileName As String
'test du lotus si ouvert
strFileName = "D:\Lotus\Notes\nlnotes.exe"
If Not FileLocked(strFileName) Then
MsgBox "Votre messagerie Lotus est fermé veuillez l'ouvrir"
Exit Sub
End If |
[VBA]
Et ça marche !!!!