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 116 117
|
Sub premierIE()
Set WB = ActiveWorkbook
Set WS = WB.Worksheets("préavis")
unifstatut = "31/12/2013" 'définition de la date de l'unification des statuts
Set IE = CreateObject("InternetExplorer.Application") 'définition de IE
'Check d'abord sur les champs renseignés si tout est bien rempli
If WS.Cells(3, 2) = "" Then
MsgBox "Veuillez entrer une date d'entrée svp", vbOKOnly + vbInformation, "date d'entrée"
Exit Sub
End If
If WS.Cells(3, 2) < unifstatut And Cells(10, 2) = "" Then
MsgBox "Veuillez mentionner les données salariales svp", vbOKOnly + vbInformation, "entrée avant le 31/12/2013"
Exit Sub
End If
If WS.Cells(4, 2) = "" Then
MsgBox "Veuillez entrer une date de sortie svp", vbOKOnly + vbInformation, "date de sortie"
Exit Sub
End If
If WS.Cells(5, 2) = "" Then
MsgBox "Veuillez entrer un type de sortie svp", vbOKOnly + vbInformation, "type de sortie"
Exit Sub
End If
IE.navigate "http://www.opzegging.be/ECMS_CLIENT/configuration/pages/calculator.php"
WaitIE IE 'Wait
IE.Visible = True 'affichage ou non
WaitIE IE 'Wait
'on pointe le membre document
Set IEDoc = IE.document
WaitIE IE
'on pointe la zone de nom et écrit le texte à l'intérieur
Set InputEcaroZoneTexte = IEDoc.all("naam")
InputEcaroZoneTexte.Value = "test"
'idem date d'entrée
Set InputEcaroZoneTexte2 = IEDoc.all("datum_indiensttreding")
InputEcaroZoneTexte2.Value = WS.Cells(3, 2)
'idem date de sortie
Set InputEcaroZoneTexte3 = IEDoc.all("datum_ontslag")
InputEcaroZoneTexte3.Value = WS.Cells(4, 2)
DoEvents
'si démission coche démission, sinon coche licenciement
If WS.Cells(5, 2) = "démission" Then
Set InputEcaroZoneTexte4 = IEDoc.all("ontslaggever_0")
InputEcaroZoneTexte4.setAttribute "checked", True
Else
Set InputEcaroZoneTexte4 = IEDoc.all("ontslaggever_1")
InputEcaroZoneTexte4.setAttribute "checked", True
End If
'selection des cas possibles
Select Case WS.Cells(3, 2)
Case Is < unifstatut And WS.Cells(5, 2) = "démission"
Call cas1 'entrée avant unification + démission
Case Is < unifstatut And WS.Cells(5, 2) <> "démission"
Call cas2 'entrée avant unification + licenciement
Case Is > unifstatut And WS.Cells(5, 2) = "démission"
Call cas3 'entrée après unification + démission
Case Is > unifstatut And WS.Cells(5, 2) <> "démission"
Call cas4 'entrée après unification + licenement
End Select
WaitIE IE
'fermeture page
IE.Quit
Set IE = Nothing
Set IEDoc = Nothing
End Sub
Sub WaitIE(IE As InternetExplorer)
Do Until IE.readyState = 4
DoEvents
Loop
While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy = True
DoEvents
Wend
End Sub
Sub cas1()
If WS.Cells(16, 2) < 32254 Then
Set InputEcaroZoneTexte4 = IEDoc.all("arbeiderbediende_1")
End If
If WS.Cells(16, 2) > 32255 And WS.Cells(16, 2) < 64508 Then
Set InputEcaroZoneTexte4 = IEDoc.all("arbeiderbediende_2")
End If
If WS.Cells(16, 2) > 64509 Then
Set InputEcaroZoneTexte4 = IEDoc.all("arbeiderbediende_3")
End If
InputEcaroZoneTexte4.setAttribute "checked", True
WaitIE IE 'Wait
'on pointe notre bouton et click dessus
Set InputEcaroBouton = IEDoc.all("calculate")
InputEcaroBouton.Click
WaitIE IE 'Wait
'on prend le résultat et le transpose dans l'excel
WS.Cells(3, 4) = IEDoc.body.all(271).innerText
End Sub |
Partager