title: Clicking a JavaScript link on website
body: <p>I am trying through VBA to generate automatically a report from my bank's website.</p>
  
  <p>I managed to reach the website and plug in my user id and password without any problem. I've reached the page where I can normally generate the report.
  Now I have to simulate a click on the link... But I can't manage to do it.</p>
  
  <p>Here is a screenshot of the website, with the HTML code of the link I have to click on to generate the report (Summary Report Copy).</p>
  
  <p><img src="https://i.stack.imgur.com/5G4Ae.png" alt="screenshot"></p>
  
  <p>Here is the HTML code of the link I need to click on:</p>
  
  <pre><code>&lt;a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#"  style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' &amp;amp; isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false" class=""&gt;Summary Report Copy&lt;/a&gt;
  </code></pre>
  
  <p>I've tried this line of VBA code, but doesn't work:</p>
  
  <blockquote>
    <p>IE.Document.getElementById("irCustomStepOne:headerDataTableId:23:reportnamestatus").FireEvent "onclick"</p>
  </blockquote>
  
  <p>How can I click on this "Summary Report Copy" thanks to VBA?</p>
  
  <p>Here is the complete HTML code of the part of the webpage where the link is located. Maybe I am not using the right ID?</p>
  
  <pre><code> &lt;td width="290px"&gt;
   &lt;span id="irCustomStepOne:headerDataTableId:23:reportNmGrp"&gt;
   &lt;a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' &amp;amp; isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false"&gt;Summary Report Copy&lt;/a&gt;
   &lt;a id="irCustomStepOne:headerDataTableId:23:reportnamePrint" href="#" style="float:left;display:none;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if (!onReportLink(\'23\')) return false;','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamePrint\':\'irCustomStepOne:headerDataTableId:23:reportnamePrint\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Print\'},\'_blank\')');return false"&gt;Summary Report Copy&lt;/a&gt;
   &lt;span id="irCustomStepOne:headerDataTableId:23:rpId" style="float:left;display:none;"&gt;3368127&lt;/span&gt;
   &lt;/span&gt;
   &lt;/td&gt;
  </code></pre>