Bonjour, j'utilise plusieurs logiciel pour le travail et je voulais savoir comment je pourrais faire revenir excel au premier plan.

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
26
27
Option Explicit
 
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As String) As Long
 
Sub applicationpremierplan()
  Dim hwnd As Long
Dim Logiciel As String
 Logiciel = "Microsoft Excel - " & ThisWorkbook.Name
 hwnd = FindWindow(vbNullString, Logiciel)
 If hwnd = 0 Then
  Logiciel = ThisWorkbook.Name
  hwnd = FindWindow(vbNullString, Logiciel)
 End If
 If hwnd = 0 Then
 Logiciel = "Microsoft Excel - " & ThisWorkbook.Name & " [Lecture seule]"
  hwnd = FindWindow(vbNullString, Logiciel)
 End If
 If hwnd = 0 Then
 Logiciel = ThisWorkbook.Name & " [Lecture seule]"
  hwnd = FindWindow(vbNullString, Logiciel)
 End If
 BringWindowToTop hwnd
 ShowWindow hwnd, 1
 Message.Show 0
End Sub
j'ai déjà essayé ceci mais cela ne fonctionne pas

Merci de votre aide