Dim IE As Object 'Ici déclaration de l'objet en variable globale locale
' a adapter pour ton application
Sub PourTest()
'Mise en place de la fenêtre IE en invisible
Prepa_Pop_up "attention c'est bientôt la fin"
If Application.Wait(Now + TimeValue("0:00:10")) Then ' ici temps sur 10 secondes
Application.SendKeys ("%{TAB}")
DoEvents
'Affichage de la fenêtre IE
msgbox_popup 5
End If
IE.quit
Set IE = Nothing
End Sub
Sub Prepa_Pop_up(Txt As String)
'Anticipation chargement et création de l'écran IE
Set IE = CreateObject("internetexplorer.application") 'Création de l'instance IE avant d'en avoir besoin
Txt = Replace(Replace(Txt, vbCr, "<BR>"), vbLf, "<BR>")
Txt = "<FONT SIZE=10 color='red'><CENTER>" & Txt & "</CENTER></FONT>"
With IE
.Navigate ("about:blank")
.Width = 700
.Height = 150
.Top = 200
.Left = 250
.document.write Txt
.document.Title = "Message de Andry"
.addressbar = False
.MenuBar = False
.StatusBar = False
.Toolbar = False
End With
End Sub
Sub msgbox_popup(Durée As Integer)
'Affichage de l'écran IE
'On Error Resume Next
IE.Visible = True
Application.Wait Now + Durée / 3600 / 24
End Sub