import data from Web

newnew005

New Member
Joined
Apr 22, 2020
Messages
12
Office Version
  1. 2019
Platform
  1. Windows
Dear ALL,

I follow your video, I want to import data from Web of this link https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx

When I run from web, in explore I read the link, document, does not have TABLE, but I can read table and data, on TABLE VIEW and DATA VIW, when I press LOAD or CHANGE, it load a table only, no data. Please teaching me what is my mistake and how to do? THX! 擷取.PNG
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to the Board:

You could do it entirely with VBA; the example below uses the Chrome driver to get to the desired table.

Would you like this kind of solution?

VBA Code:
Sub HongKongFoo()
Dim driver As New ChromeDriver, pt
driver.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Set pt = driver.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
MsgBox pt.FindElementsByTag("tr").Count, 64, "Number of table rows"
End Sub
 
Upvote 0
Welcome to the Board:

You could do it entirely with VBA; the example below uses the Chrome driver to get to the desired table.

Would you like this kind of solution?

VBA Code:
Sub HongKongFoo()
Dim driver As New ChromeDriver, pt
driver.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Set pt = driver.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
MsgBox pt.FindElementsByTag("tr").Count, 64, "Number of table rows"
End Sub

Dear Worf,
Thanks for your reply.
I am a newbie of Excel.
1. Do I need to install Chromedriver firstly.
2. I copy your TXT to VBA and RUN marco, VBA warning me "HongKongFoo()" trun to yellow.
3. Would you like to teaching me step by step how to use SUB - End Sub.
THANKS!
 
Upvote 0
Yes, you need to install it. This can be a bit of work but is done only once, and after that you have a great tool.

Below I am providing three links and the explanations.

Link 1 – Selenium download page

Selenium Basic

Link 2 – General process overview

Excel VBA Selenium

Link 3 – Chrome driver download

Chromium

  • Install Selenium from the first link
  • Add a reference to it in the VBE, as shown on the second link
  • Check if the installed Chrome driver executable file is compatible with the Chrome version you are using. You can do that by downloading it from the third link and comparing the dates. If they are different, replace the installed one with the downloaded one, as shown on the picture below. Note that it is the Selenium Basic folder.
If all went well, the VBA code should run now; tell us how it goes…

cdriver.PNG
 
Upvote 0
Dear Worf,
I follow your teaching and read the doc. more times.
the result:

1588654818946.png




Yes, you need to install it. This can be a bit of work but is done only once, and after that you have a great tool.

Below I am providing three links and the explanations.

Link 1 – Selenium download page

Selenium Basic

Link 2 – General process overview

Excel VBA Selenium

Link 3 – Chrome driver download

Chromium

  • Install Selenium from the first link
  • Add a reference to it in the VBE, as shown on the second link
  • Check if the installed Chrome driver executable file is compatible with the Chrome version you are using. You can do that by downloading it from the third link and comparing the dates. If they are different, replace the installed one with the downloaded one, as shown on the picture below. Note that it is the Selenium Basic folder.
If all went well, the VBA code should run now; tell us how it goes…

View attachment 12345
 
Upvote 0
  • The message appeared because you tried to execute the code again while in break mode, caused by a previous error. I need to know the error number, as shown in figure 1 below.
  • Do you have the Selenium reference, as shown in figure 2?
selenium.PNG
 
Upvote 0
Tell me what is your Chrome version and the date of the Chrome driver executable file in the Selenium basic directory.

My info is 81.0.4044.129 and 15/3/20.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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