Voici mon code pour savoir si Excel est ouvert...
Comme c'est une application sans référence...
private Excel97 as new excel97.application
Sub GetExcel()
Dim ExcelWasNotRunning As Boolean ' Flag for final release.
On Error Resume Next ' Defer error trapping.
Set excel97 = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
ExcelWasNotRunning = True
Err.Clear ' Clear Err object in case error occurred.
End If
If ExcelWasNotRunning = True Then
Set excel97 = CreateObject("Excel.Application")
Else
'Shell "C:\Program Files\Microsoft Office\Office\EXCEL.EXE", vbMaximizedFocus
Set excel97 = GetObject(, "Excel.Application")
End If
End Sub
-------------------------------
Réponse au message :
-------------------------------
Bonjour a tous!
je voudrais savoir comment faire pour savoir si un logiciel (appelé CIEL) est ouvert ou pas.
Je veux le savoir en cliquant sur un bouton, qui m'affichera un msgbox.
merci.
