Titre du sujet : Re: Récupération de données sur le web par myDearFriend! le 01/11/2011 21:15:42
Bonsoir fixsurfer, bienvenue sur XLpages.com
Peut-être une réponse possible à ton problème dans la pièce jointe...
J'ai utilisé ce code VBA :
Option Explicit
'------------------------------------------------------------------------
' Auteur : Didier FOURGEOT (myDearFriend!) - www.mdf-xlpages.com
' Date : 01/11/2011
' Sujet : RecupWeb Listing BD
'------------------------------------------------------------------------
Sub RecupNbTomes()
Dim IE As InternetExplorer
Dim vUrl As String, T As String
Dim L As Long, Lmax As Long
Application.ScreenUpdating = False
Set IE = CreateObject("internetExplorer.Application")
IE.Visible = False
With Sheets("www.mdf-xlpages.com")
Lmax = .Cells(.Rows.Count, 6).End(xlUp).Row
For L = 5 To Lmax
Application.StatusBar = (L - 4) * 100 \ (Lmax - 4) & "%... " & .Cells(L, 2).Text
'URL
vUrl = .Cells(L, 6).Text
'Ouvre la page web dans IE de façon invisible
IE.Navigate vUrl
Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
T = IE.Document.body.innerText
.Cells(L, 3).Value = Val(Mid(T, InStr(1, T, "Nb. tomes parus :") + 17))
Next L
End With
'Quitter IE
IE.Quit
Set IE = Nothing
Application.StatusBar = False
Application.ScreenUpdating = True
MsgBox "Mise à jour nombre de Tomes réalisée !", vbInformation + vbOKOnly, "myDearFriend! - www.mdf-xlpages.com"
End Sub
Et comme l'exécution d'une telle procédure au lancement d'un classeur ne me semble pas être une bonne idée, j'ai préféré t'ajouter un bouton pour lancer la mise-à-jour (un clic sur le bouton et un peu de patience restent nécessaires...)
En espérant t'avoir dépanné.
Cordialement,
|