Excel VBA to find href in HTML -


i'm writing macro following:

  1. pulling info various spreadsheets
  2. assign necessary info variables
  3. open website
  4. login website
  5. click "start" button [current problem]
  6. enter variables form
  7. submit form

i need click button says "start" links monthly form need fill out. button links different page each month url similar, includes "surv/questionnaire/" string of 6 numbers.

i guess need either find way click start button or pull href looking "surv/questionnaire/*" i'm new @ working html maybe i'm way off.

relevant vba code:

dim ie object 'launch internet explorer, navigate website set ie = createobject("internetexplorer.application") ie     .visible = true     .navigate "https://respond.fakewebsite.net/surv"     .top = 50     .left = 530     .height = 800     .width = 1200     until not ie.busy , ie.readystate = 4         doevents     loop end  'login website if ie.locationname = "surv: welcome"     ie.document.getelementbyid("username").value = "fakeuser"     ie.document.getelementbyid("password").value = "fakepass"     ie.document.forms(0).all("submit").click     until not ie.busy , ie.readystate = 4         doevents     loop end if 

so code brings me right point need click start button.

relevant (i think) html:

<div class="dashboard_header">survey tasks <span style="color:#fff;font-size:small;">(total forms: 1)</span></div>  <div id="inner"> <table class="survey_tasks"> <tr>   <th width="">form</th>   <th width="">action</th>   <th width="">status</th>   <th width=""><abbr title="file number">fn</abbr></th>   <th width="">ind <br />category</th>   <th width="">hist<br /> data</th>   <th width="">view/print<br /> pdf</th> </tr>    <tr>   <td>1.</td>    <!-- action buttons -->   <td>     <a class="dashboard_button" href="https://respond.fakewebsite.net/surv/questionnaire/13524">start</a>   </td> 

i've changed information above remove exact website , other login information in vba last line of html includes link i'm trying have macro launch before entering variables form. i've tried using function proposed this question cannot work either. looking either guidance on how use solution or possibly solution that's better suited problem.


Comments