How to change VBA code to import google cse API RSS feed

satish78

Board Regular
Joined
Aug 31, 2014
Messages
218
Hi

below code extracts rss from bing.com
I Wanted to change below code to import rss feed from google CSE api urls list
Attached sample file.
https://spaces.hightail.com/space/dFNYS0QY0G

I do not want post google cse API url in here.

HTML:
Dim rCount As Long
Public Sub GetDataFromBing(ByVal strurl As String)
    Dim xDOC As DOMDocument
    Dim XMLHttpRequest As XMLHTTP
    Dim response As String
    Dim URL As String
    Dim sTemperature As String
     
    'URL = "http://www.bing.com/search?q=Aaron%20BentDirector%20Business%20Development%20at%20Analyze%E2%80%A6locationindustry&qs=&format=rss"
    URL = strurl
    Set XMLHttpRequest = New MSXML2.XMLHTTP
    With XMLHttpRequest
        .Open "GET", URL, False
        .send
    End With
     
    Set xDOC = New DOMDocument
     
    Do Until xDOC.readyState = 4
    Loop
    xDOC.LoadXML (XMLHttpRequest.responseText)
    Set xNode = xDOC.SelectSingleNode("//channel")
    
    Dim strValue As String
    
     For FieldIndex = 1 To xNode.ChildNodes.Length
        If FieldIndex > 5 And FieldIndex <= 6 Then
            Set items = xNode.ChildNodes(FieldIndex)
            If Not items Is Nothing Then
                For ItemIndex = 0 To items.ChildNodes.Length - 1
                Set Node = items.ChildNodes(ItemIndex)
                Sheet1.Cells(rCount, ItemIndex + 1).Value = Node.nodeTypedValue
                Next ItemIndex
            End If
            rCount = rCount + 1
        End If
    Next FieldIndex
     
    On Error Resume Next
     
  
End Sub

Public Sub loadURL()
Dim sh As Worksheet
Dim rw As Range
Dim RowCount As Long

RowCount = 0
rCount = 3
Set sh = ActiveSheet
For Each rw In sh.Rows
If RowCount >= 2 Then
    If sh.Cells(rw.Row, 1).Value = "" Then
        Exit For
      Else
        GetDataFromBing sh.Cells(rw.Row, 1).Value
        
      End If
End If
  

  RowCount = RowCount + 1

Next rw

MsgBox (RowCount)
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top