VBA: how to navigate and click links inside html webpage

Valvolino78

New Member
Joined
Dec 20, 2018
Messages
4
Hi everyone,
I'm new to using VBA to log to, and navigate through, a website and I'd need some help.
I've read a lot on this and other forums but I still miss a kinda guide for coding by myself.
This is the firs problem I'm struggling with by now: I have to click on a link embedded in a tag named "Dichiarazioni Fiscali" which is in a tree such this

VBA Code:
<div class "vocimenu"

        <h2 (...nothing relevant for me)

        <h2 (...nothing relevant for me)

        <h2 class="trigger"><a href="#">Informazioni<BR>REDDITUALI</a></h2>

                  <div class="datiMenu2">
                  <ul class="menu_ul">

                        <li class="el_link">   
                             <A  href="/SerpicoUffici/SerpicoWebServlet?Ric=Dich&CF=BNLRRT49D13I046S">
                                    Dichiarazioni Fiscali
                             </A>
                        </li>

The second one that immediately follows (in the case I'll solve the first) deals with tables inside a webpage.
I have a table with multiple rows (the image is of the first one) and mutiple columns with years from 1990 to 2022 (it's a scrolling table)
SnipImage[441].JPG

and I have to click on the first flagged year (2016 in image).
Here's the code (I've secreted some infos with "XXX" and "YYY": @ "YYY" is the href containing the link embedded in the flagged year):
HTML:
<br>
              <div class="outer">
               <div class="inner">
             <table class="scorrimento"  summary="La tabella riporta l'elenco dei documenti disponibili per l'area">

            <tr class="rigatitoli_tabella_bordato">
                <th style="background-color: #ffffff"> </th>
        
                <td id="2022">
                    2022
                </td>

                <td id="2021">
                    2021
                </td>

                <td id="2020">
                    2020
                </td>

                <td id="2019">
                    2019
                </td>

                <td id="2018">
                    2018
                </td>

                <td id="2017">
                    2017
                </td>

                <td id="2016">
                    2016
                </td>

                <td id="2015">
                    2015
                </td>

                <td id="2014">
                    2014
                </td>

                <td id="2013">
                    2013
                </td>

                <td id="2012">
                    2012
                </td>

                <td id="2011">
                    2011
                </td>

                <td id="2010">
                    2010
                </td>

                <td id="2009">
                    2009
                </td>

                <td id="2008">
                    2008
                </td>

                <td id="2007">
                    2007
                </td>

                <td id="2006">
                    2006
                </td>

                <td id="2005">
                    2005
                </td>

                <td id="2004">
                    2004
                </td>

                <td id="2003">
                    2003
                </td>

                <td id="2002">
                    2002
                </td>

                <td id="2001">
                    2001
                </td>

                <td id="2000">
                    2000
                </td>

                <td id="1999">
                    1999
                </td>

                <td id="1998">
                    1998
                </td>

                <td id="1997">
                    1997
                </td>

            </TR>

            <tr class="riga2_tabella">
                <th style="background-color: #e6e6e6;">
                    Modello 730
                </th>

            
                <TD headers="2022"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Annualità non prevista o fuori linea">
                        
                </td>
    
                        
                <TD headers="2021"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Informazione non presente">
                        
                </td>
    
                        
                <TD headers="2020"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Informazione non presente">
                        
                </td>
    
                        
                <TD headers="2019"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Informazione non presente">
                        
                </td>
    
                        
                <TD headers="2018"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Informazione non presente">
                        
                </td>
    
                        
                <TD headers="2017"

                >

                        
                                <img src="/xxx.gif" border="0" alt="Informazione non presente">
                        
                </td>
    
                        
                <TD headers="2016"

                >


                                <a href="YYY=" title="vai al documento">           
                                    <img src="/SerpicoStatic/consultazioni/immagini/S.gif" border="0" alt="Informazione presente">
                                </a>

Very thanks in advance.
Regards.
V78
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,109
Messages
6,123,136
Members
449,098
Latest member
Doanvanhieu

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