extract data from web to inside sheet without open website &refersh

tubrak

Board Regular
Joined
May 30, 2021
Messages
218
Office Version
  1. 2019
Platform
  1. Windows
hi experts
I have this website CMA CGM | A world leader in maritime and logisticsshows me my cargo where is location & when arrive and departure . it depends on CONTAINER NO or B\L NO
let's take CONTAINER NO as the pic 1
1.PNG


and when press shipment tracking it will shows the detials as this picture
2.PNG


so what I want based on last picture show in columns A,B,C,D,E,F= DATE, TIME , MOVES,LOCATION,VESSEL,VOYAGE without open website
and I want put the CONTAINER NO or B\L NO into TEXTBOX1 ACTIVE X and I would press F5 to refresh the search inside the sheet
somtimes doesn't show detiales that's because CONTAINER NO or B\L NO is wrong then should show warning message" please make sure the right detiales "
by the way I use browser google chrome .
thanks
 
From what I read (searching vba selenium cannot find chrome binary) this means that Chrome is not installed in the default directory.
In my system (Win 11), this is C:\Program Files (x86)\Google\Chrome\Application

For example:

In both the articles there are instruction for using Chrome in a non standard position, but I am not able to translate then into vba instructions, sorry
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
the google chrome is in my PC C:\Program Files \Google\Chrome\Application
In both the articles there are instruction for using Chrome in a non standard position, but I am not able to translate then into vba instructions, sorry
I don't understand this
 
Upvote 0
Apologies if I've missed something, but why not use PowerQuery: On the Data Ribbon, go to 'From Web', Navigate to the relevant website. I'm sure there is a way you can provide the package number, but confess this is as much as I can offer.
 
Upvote 0
@pjmorris thanks for your suggestion !
actually I don't used to PQ . as to me I prefer VBA , but I don't mind if find solution by PQ .
 
Upvote 0
Let's try using Edge

To install selenium edge driver:
-open Edge and in the address bar type edge://settings/help
-write down the installed version; I have "Version 101.0.1210.39 (Official Build) (64 bit)
-Edge drivers can be downloaded from here: Microsoft Edge WebDriver - Microsoft Edge Developer
-select a version compatible for your browser, download it and open with an unzipper; I downloaded Version: 101.0.1210.39 for x64
-extract file MSEDGEDRIVER.exe to the same location where Selenium was installed (thus C:\Users\PC WORLD\AppData\Local\SeleniumBasic, in your case)
-in you already have any "edgedriver.exe" in the directory, delete that file
-rename MSEDGEDRIVER.exe as edgedriver.exe

At this point:
-download again the file from dropbox, at 4TUBRACK_MrEx_C20511.xlsm
(this is the same link I published before, but I have update the content)
-the operating procedures are the same, but now you have a second button that calls Sub myCallerEdge, a new version of the macro that open Edge instead of Chrome (this implies changing only 1 line in the code)
Try it, maybe we have more luck with Edge.
Again, as Edge get updated you need to update the driver, and I don't know if it is possible to selectively disable Edge updating
 
Upvote 0
perfect ! but I have some questions .

first when I put any container number in b2 supposes bring the data automatically without any problem if the container is right , right?

second what's the problem with coogle chrome , do you have any idea to fixing?
 
Upvote 0
first when I put any container number in b2 supposes bring the data automatically without any problem if the container is right , right?
The macro starts when you invoke it, either using the button or any other method available in Excel. The macro read B2 and submit the request to the site, then write the results.
If data in B2 is invalid probably you will get back nothing, other than a default "No information returned"


second what's the problem with coogle chrome , do you have any idea to fixing?
It seems your Chrome is not installed where the driver expects it to be; but I am a "selenium user", not a selenium specialist thus I don't know how to correct it
 
Upvote 0
last thing what means this
VBA Code:
WPage.Wait 1000
,
VBA Code:
 WPage.Wait 100
,
VBA Code:
WPage.Wait 200
is it time to run the macro?
 
Upvote 0
They are delays (milliseconds) to make (almost) sure that the commands get executed before moving to the next line
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,155
Members
452,615
Latest member
bogeys2birdies

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