Vous utilisez un navigateur obsolète. Il se peut que ce site ou d'autres sites Web ne s'affichent pas correctement. Vous devez le mettre à jour ou utiliser un navigateur alternatif.
ouvrir page web avec mon code et telecharger fichier texte
Boostez vos compétences Excel avec notre communauté !
Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force.
Apprenez, échangez, progressez – et tout ça gratuitement !
👉 Inscrivez-vous maintenant !
Re : ouvrir page web avec mon code et telecharger fichier texte
Bonjour Jean Pierre, Bruno,
Merci pour les liens .Je n'avais pas bien lu
J'ai testé les 3 procedures suivantes mais ca se bloque à la saisie du premier code : 25254
Sub piloterPageWeb()
'nécéssite d'activer la référence Microsoft HTML Objects Library
'nécéssite d'activer la référence Microsoft Internet Controls
Dim i As Integer
Dim ie As InternetExplorer
Dim maPageHtml As HTMLDocument
Dim Helem As IHTMLElementCollection
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://www.unss.org/acadas/Search/mode/LI"
Do Until ie.readyState = READYSTATE_COMPLETE
DoEvents
Loop 'attend la fin du chargement
Set maPageHtml = ie.document
Set Helem = maPageHtml.getElementsByTagName("input")
'(boucle pour lister les objets type 'input' de la page)
'For i = 0 To Helem.Length - 1
'MsgBox Helem(i).getAttribute('name') & ' / ' & Helem(i).getAttribute('value')
'Next i
Helem(0).innerText = "xxxx"
Helem(1).innerText = 25254
Helem(2).Click 'simulation clic
End Sub
Public Sub SecureLogin()
'auteur: Norie
Const strURL_c As String = "http://www.unss.org/acadas/Search/mode/LI"
Const strUsr_c As String = "xxxxxx" 'this is where i set my UserID
Const strPwd_c As Long = 25254 'this is where i set my password
Dim objIE As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
Dim tbxPwdFld As MSHTML.HTMLInputElement
Dim tbxUsrFld As MSHTML.HTMLInputElement
Dim btnSubmit As MSHTML.HTMLInputElement
'Create Internet Explorer Object
Set objIE = New SHDocVw.InternetExplorer
'Navigate the URL
objIE.navigate strURL_c
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
'Get document object
Set ieDoc = objIE.document
Set frm = ieDoc.frames(0).document.forms
'ici mettre le nom correct des champs
Set tbxUsrFld = frm(0).all.Item("txtUserId")
Set tbxPwdFld = frm(0).all.Item("txtPassword")
Set btnSubmit = frm(0).all.Item("submit")
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
End Sub
Sub web_login()
'key: submit on Internet Explorer Form
'auteur: Cjeh
'(mrexcel message board)
Dim ie As Object
On Error GoTo error_h
Set ie = CreateObject("InternetExplorer.Application")
With ie
'ici l'adresse du site
.navigate "http://www.unss.org/acadas/Search/mode/LI"
Do While .Busy: DoEvents: Loop
Do While .readyState <> 4: DoEvents: Loop
.Visible = True
With .document.forms("Identification")
.Password.Value = "xxxx"
.login.Value = 25254
.submit2.Click
End With
.Visible = True
End With
Set ie = Nothing
Exit Sub
error_h: MsgBox "Unexpected Error."
ie.Quit
Set ie = Nothing
End Sub
- Navigue sans publicité - Accède à Cléa, notre assistante IA experte Excel... et pas que... - Profite de fonctionnalités exclusives Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel. Je deviens Supporter XLD