VBA and IE: how to change the ClassName of a Table

AymericA

New Member
Joined
May 18, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello!
I am using VBA and Excel to extract some data of a website.
My problem is the following. Data appear in a table only if its class indicates " " rather than ""is-user"

<table id="tableID" className="is-user">

I have no issue identifying this table as it has an ID.
How can I change that ClassName using a VBA function?

Thanks.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi,​
as you read the data you do not need to modify the source webpage code ‼ o_O
If the ID is unique you even do not have to search for any class name but obviously just the ID …​
 
Upvote 0
Thanks Marc.
I am not allowed to read the data if the table classname is "is-user". They do not appear on screen and my VBA script is blocked.
If I change that classname to "" (in the source code), then I can see the data on screen and my script can access the data.
Is it possible?
 
Upvote 0
Same answer : if the ID is unique …​
 
Upvote 0
sorry Marc. I think I am not clear.
I do not need to find that table. Thanks to the ID, as you say, it is easy to find.
Once the table is identified, I would like to change the classname in the source code.
Still the same answer? ;)
 
Upvote 0
So once you have found the object with its ID, what happens with its property 'classname', what did you attempt ?​
 
Upvote 0
for the moment, I have in the webpage source code <table id="tableID" className="is-user">
and when I change it to <table id="tableID" className=""> directly in the source code then my script works.
is there a VBA script to change this property 'classname' ?
 
Upvote 0
object.className = "" where object refers to the found ID and if only you are granted to modify the source webpage code …​
 
Upvote 0
Solution

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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