• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Soru Dizi takvimi bilgilerini çekme makrosu

Anlaşıldı ...... bir şekilde, bilgisayarınızdaki "XMLHTTP" nesnesi "NextSibling" metodunu desteklemiyor.

Onun yerine başka birşey kullanmak gerekiyor.

.
 
Emülator ayarlaması işe yarayabilir...


.
 
Office365 için bir de aşağıdaki kodu deneyin, olacak mı bilmem.... (2010 versiyonda bu da çalışıyor)

C#:
Sub Test4()
'   Haluk - 21/06/2022
'   sa4truss@gmail.com

    Dim HTTP As Object, HTML As Object, i As Integer, j As Integer, k As Integer, z As Integer
    Dim myURL As String
   
    Range("B1:AJ" & Rows.Count) = ""
   
    Set HTML = CreateObject("HTMLFILE")
    Set HTTP = CreateObject("MSXML2.XMLHTTP")
   
    myURL = "https://www.tvmaze.com/calendar"
   
    HTTP.Open "GET", myURL, False
    HTTP.send
   
    HTML.body.innerHTML = HTTP.responseText
    Set objCollection = HTML.getElementsByTagName("span")
   
    i = 0
    j = 1
    Do While i < objCollection.Length
        If objCollection(i).ClassName = "dayofmonth" Then
            j = j + 1
            Cells(1, j) = objCollection(i).innerText
        End If
        i = i + 1
    Loop
   
    Set objCollection = HTML.getElementsByTagName("ul")
    i = 0
    j = 1
   
    Do While i < objCollection.Length
        If objCollection(i).ClassName = "episodes" Then
            j = j + 1
            k = 2
            xData = Split(objCollection(i).innerText, vbCrLf)
           
            For z = LBound(xData) To UBound(xData)
                Cells(k, j) = xData(z)
                k = k + 1
            Next
        End If
        i = i + 1
    Loop
   
    Set objShows = Nothing
    Set HTML = Nothing
    Set HTTP = Nothing
End Sub


.
 
Tuhaf.... bende 5 No'lu mesajdaki görselde belirttiğim gibi çıkıyor.


Siz bir de, kodda ilgili yeri aşağıdakiyle değiştirip deneyin;

C#:
            For z = LBound(xData) To UBound(xData)
                If Len(xData(z)) > 2 Then
                    Cells(k, j) = xData(z)
                    k = k + 1
                End If
            Next

.
 
Son düzenleme:
Tuhaf.... bende 5 No'lu mesajdaki görselde belirttiğim gibi çıkıyor.


Siz bir de, kodda ilgili yeri aşağıdakiyle değiştirip deneyin;

C#:
            For z = LBound(xData) To UBound(xData)
                If Len(xData(z)) > 2 Then
                    Cells(k, j) = xData(z)
                    k = k + 1
                End If
            Next

.


Kod:
Sub Test4()
'   Haluk - 21/06/2022
'   sa4truss@gmail.com

    Dim HTTP As Object, HTML As Object, i As Integer, j As Integer, k As Integer, z As Integer
    Dim myURL As String
 
    Range("B1:AJ" & Rows.Count) = ""
 
    Set HTML = CreateObject("HTMLFILE")
    Set HTTP = CreateObject("MSXML2.XMLHTTP")
 
    myURL = "https://www.tvmaze.com/calendar"
 
    HTTP.Open "GET", myURL, False
    HTTP.send
 
    HTML.body.innerHTML = HTTP.responseText
    Set objCollection = HTML.getElementsByTagName("span")
 
    i = 0
    j = 1
    Do While i < objCollection.Length
        If objCollection(i).ClassName = "dayofmonth" Then
            j = j + 1
            Cells(1, j) = objCollection(i).innerText
        End If
        i = i + 1
    Loop
 
    Set objCollection = HTML.getElementsByTagName("ul")
    i = 0
    j = 1
 
    Do While i < objCollection.Length
        If objCollection(i).ClassName = "episodes" Then
            j = j + 1
            k = 2
            xData = Split(objCollection(i).innerText, vbCrLf)
         
            For z = LBound(xData) To UBound(xData)
                If Len(xData(z)) > 2 Then
                    Cells(k, j) = xData(z)
                    k = k + 1
                End If
            Next
        End If
        i = i + 1
    Loop
 
    Set objShows = Nothing
    Set HTML = Nothing
    Set HTTP = Nothing
    ActiveSheet.UsedRange.EntireColumn.AutoFit
End Sub

10 numara oldu hocam, teşekkür ederim. Kullanmak isteyen olursa diye kodları buraya bıraktım.


237395
 
Geri
Üst