Bonjour à tous,
je souhaiterai que ma macro excel lance une application différente (application en .exe) en fonction du résultat d'une cellule (résultat donné par un aléa entre bornes)
Exemple :
Si A1 = 1 alors on lance l'application "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Si A1 = 2 alors on lance l'application "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
....
Voici la macro existante en question :
Sub attends()
Dim f As Integer
Dim Cellule As Range
Dim Plage_C As Range, Plage_D As Range
Heure_Actuelle = Timer
Randomize
Nb_Seconde = Int((30 - 15 + 1) * Rnd + 15)
Do
If Not Time = "16:30:00" Then
If Int(Timer - Heure_Actuelle) Mod Nb_Seconde = 0 Then
f = FreeFile
Application.Calculate
Open "C:\Users\NOM\Desktop\TEST.txt" For Output As #f
For Each Cellule In Range("A3:A17")
Print #f, Cellule.Text
Next
Close f
End If
Else
If Int(Timer - Heure_Actuelle) Mod Nb_Seconde = 0 Then
f = FreeFile
Application.Calculate
Open "C:\Users\NOM\Desktop\TEST.txt" For Output As #f
For Each Cellule In Range("A3:A17")
Print #f, Cellule.Text
Next
Close f
End If
Range("E9:H12").Value = Range("E5:H8").Value
End If
DoEvents
Loop
End Sub