Bonjour
En se basant sur cet ancien post : https://www.developpez.net/forums/d9...outlook-lance/
Le taskill fonctione mais il me dit toujours que le programme est lancé même s'il est fermé (modifié pour word).


Pouvez-vous m'aider ?
Merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
Function ApplyLancee(strChemin As String) As Boolean
 
    On Error Resume Next
 
    Open strChemin For Binary Access Read Write Lock Read Write As #1
    Close #1
 
    If Err.Number <> 0 Then
        ApplyLancee = True
        Err.Clear
    End If
 
End Function
 
Sub testpgm()
If ApplyLancee("C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE") = True Then
 
        MsgBox "application lancéé"
        sKillWINWORD = "TASKKILL /F /IM WINWORD.EXE"
Shell sKillWINWORD, vbHide
    Else
        MsgBox "non lancée"
    End If
End Sub