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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
| Sub CMF()
Dim IE As Object
Dim IEDoc As HTMLDocument
Dim InputZoneTexte As HTMLInputElement
Dim InputBouton As HTMLInputElement
Dim htmlTagCol As IHTMLElementCollection
Dim htmlSelectElem As HTMLSelectElement
Dim FormCherche As HTMLFormElement
Dim divHTMLCible As HTMLDivElement
'Initialisation des variables
Set IE = CreateObject("InternetExplorer.Application")
'Chargement d'une page Web Google
IE.navigate "http://62.50.134.58/intranet/exploitation/slxsm/slx_gen_report.asp?Action=Criteria&ID=841"
'Affichage de la fenêtre IE
IE.Visible = False
'On attend le chargement complet de la page
WaitIE IE
'On pointe le membre Document
Set IEDoc = IE.document
'On va sur l'objet qui contient la liste des indices
Set htmlSelectElem = IEDoc.all("[AIRPORT]")
'On sélectionne l'indice "aer" via sa valeur unique
htmlSelectElem.Value = "CMF"
'On pointe le membre Document
Set IEDoc = IE.document
'On va sur l'objet qui contient la liste des indices
Set htmlSelectElem = IEDoc.all("[SEASON]")
'On sélectionne l'indice "season" via sa valeur unique
htmlSelectElem.Value = "W14"
'On pointe notre Zone de texte
Set InputZoneTexte = IEDoc.all("[DATEDEB]")
'On définit le texte que l'on souhaite placer à l'intérieur
InputZoneTexte.Value = Range("A1").Value
'On pointe notre Zone de texte
Set InputZoneTexte = IEDoc.all("[DATEFIN]")
'On définit le texte que l'on souhaite placer à l'intérieur
InputZoneTexte.Value = Range("B1").Value
For Each SubmitInput In IEDoc.getElementsByTagName("INPUT")
'on cherche le bouton de validation
If InStr(SubmitInput.getAttribute("name"), "launch") Then
SubmitInput.Click
'une fois trouve on lance un clic
Application.Wait Time + TimeSerial(0, 0, 3)
'on attend la generation du fichier
End If
Next
Application.Wait Time + TimeSerial(0, 0, 4)
Application.SendKeys "{TAB}"
'on passe sur le bouton enregistrer
Application.Wait Time + TimeSerial(0, 0, 1)
Application.SendKeys "{TAB}"
Application.Wait Time + TimeSerial(0, 0, 1)
Application.SendKeys "{TAB}"
Application.Wait Time + TimeSerial(0, 0, 1)
Application.SendKeys "{ENTER}"
'on valide
Application.Wait Time + TimeSerial(0, 0, 5)
Application.SendKeys "{BACKSPACE}"
Application.SendKeys "J:\Svc_Expl\SUB_CT\FMP\Hiver 2014-2015\semaine XX\CMF"
Application.Wait Time + TimeSerial(0, 0, 4)
Application.SendKeys "{ENTER}"
Application.Wait Time + TimeSerial(0, 0, 2)
Application.SendKeys "{TAB}"
Application.Wait Time + TimeSerial(0, 0, 3)
Application.SendKeys "{ENTER}"
Application.Wait Time + TimeSerial(0, 0, 2)
Application.SendKeys "{ENTER}"
'on valide
WaitIE IE
'on valide
WaitIE IE
'On libère les variables
Set IE = Nothing
Set IEDoc = Nothing
End Sub |
Partager