ich möchte von einer Internetseite gerne Bilder exportieren und in meine Exceltabelle einfügen, wofür ich auch bereits einen Code habe. Doch dieser fügt manchmal, wenn er mehrere Internetseiten abklappern soll um diese zu exportieren manchmal zwei mal das selbe Bild ein und manchmal nicht. Und am Anfang, wenn er beginnt macht er oft einfach in 5 Kästchen hintereinander ein Blaues Viereck.
Ist ziemlich nervig damit zu arbeiten.. hoffe jemand kann mir da weiterhelfen!
Mein Code:
Sub SearchBot1()
Dim IE As New SHDocVw.InternetExplorer, pfad As String, sh As Shape, Bild As String, cl As _
Range, yAchse As String, xLink As String, xAchse As String, Preis As Object, Preis2 As Object
Dim Zelle As String
Dim ModelNummerKnoten1 As Object, ModelNummer1 As Object, ModelNummerKnoten2 As Object, _
ModelNummer2 As Object
IE.Visible = False
yAchse = 4
xLink = "K"
START:
yAchse = yAchse + 1
pfad = "ActiveSheet.Range(xAchse & yAchse)"
Do Until Cells(yAchse, 11).Value " " Then GoTo START
IE.navigate ActiveSheet.Range(xLink & yAchse)
Do While IE.Busy = True Or IE.readyState 4: DoEvents: Loop
'Bild
xAchse = "B"
For Each pic In IE.document.getElementsByClassName("pic")
Set cl = Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
Set sh = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 100, 100, 100, 100.25)
With sh
On Error Resume Next
.Fill.UserPicture pic.src
.LockAspectRatio = msoFalse
.Width = cl.Width
.Height = cl.Height
.top = cl.top
.Left = cl.Left
End With
cl.Value = "x"
Set cl = Nothing
Set sh = Nothing
Set pic = Nothing
Next
Freue mich auf eure Antworten!