Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scraping a CRM
#1
Hi Forum,

I'm trying to scrape some data regularly from the company CRM (Customer Relationship Management) tool that contains all the data entered & produces reports.
I'm using some adapted code & I'm fairly new to the process.
I'm also using MS Excel with VBA to do this.
Firstly, the code below will open the CRM so I thought it must then be able to scrape some content?
I've gone to the source & found the correct class to extract some data, it's where I need to split this into One Item at a time & paste into Excel is where I'm stuck.
Because I've reused some code that maybe won't fit my purpose, I've included the HTML where I've got my class from so someone could maybe help here.



Run Time Error '462'

The remote server machine does not exist or is unavailable


My code is below:

Quote:Sub scrape_crm_open()
' declare the variables
Dim ieObj As InternetExplorer
Dim htmlEle As IHTMLElement
Dim i As Integer

' initialize i to one
i = 1

' create and get access to an instance of IE
Set ieObj = New InternetExplorer
ieObj.Visible = True
ieObj.navigate "http://our_co_crm/main.aspx#"

' give the webpage some time to load all content
Application.Wait Now + TimeValue("00:00:05")

' loop through all the rows in the table
For Each htmlEle In ieObj.Document.getElementsByClassName("ms-crm-List_Data")(0).getElementsByTagName("tr") 'Error is here
With ActiveSheet
.Range("A" & i).Value = htmlEle.Children(0).textContent
.Range("B" & i).Value = htmlEle.Children(1).textContent
.Range("C" & i).Value = htmlEle.Children(2).textContent
.Range("D" & i).Value = htmlEle.Children(3).textContent
.Range("E" & i).Value = htmlEle.Children(4).textContent
End With

i = i + 1
Next htmlEle

End Sub
Quote
#2
This is a Python forum, not VBA forum
Quote
#3
Thanks but I didn't think that a VBA forum would be able to help with this either considering I use Python usually for scraping.
But of course, you're right.

Could anyone answer this question though, Using Python, can I scrape data from an application such as a CRM database, in this case Microsoft Dynamics 365?

Thanks again
Quote
#4
I only have a vague idea of what a CRM database looks like.
If you can give me a url for a site I can experiment on, I'll give it a go.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)