dispatchEvent - VBA IE automation
<p>I have a question I can't seem to figure out the answer to regarding how to dispatch an event in VBA. </p>

<p>On the website I am trying to navigate via VBA, there is a dynamic table id="G_grdProfile". In the table html, there are events listed. The table itself is dynamic. At minimum there will always be a row with the id="grdProfile_r_0". Within that row, there are cells that can be clicked. There can be id="grdProfile_rc_0_0", grdProfile_rc_0_1", etc. </p>

<p>I assume I need to dispatch the event in relation to the row or individual cell within the row, but I can't seem to get it to work. From using developer tools in Chrome and IE, it looks like either the ondblclick or onmousedown events are fired when a cell (other than 17) is clicked.
And .click does not return an error, but does not do anything.</p>

<p>My code is:</p>

<pre><code>     With ie
 While .Busy Or .ReadyState &lt;&gt; 4: DoEvents: Wend
 Application.Wait (Now + TimeValue("0:00:02"))
 Set objLink = .Document.frames("mainParent").Document.forms("AgentProfileList").Document.getElementById("G_grdProfile").Document.getElementById("grdProfile_r_0").Document.getElementById("grdProfile_rc_0_2")
 objLink.dispatchEvent ("onmousedown")
 End With        
</code></pre>

<p>The HTML referenced above for this section is:</p>

<pre><code>&lt;TABLE onmouseup='igtbl_cellClickUp(event,"grdProfile");' onmouseover='igtbl_cellMouseOver(event,"grdProfile");' ondblclick='igtbl_cellDblClick(event,"grdProfile");' onmousemove='igtbl_cellMouseMove(event,"grdProfile");' onmousedown='igtbl_cellClickDown(event,"grdProfile");' onmouseout='igtbl_cellMouseOut(event,"grdProfile");' id=G_grdProfile onselectstart='igtbl_selectStart(event,"grdProfile");' style="WIDTH: 978px; TABLE-LAYOUT: fixed; POSITION: relative" oncontextmenu='igtbl_cellContextMenu(event,"grdProfile");' cellSpacing=0 cellPadding=0 border=0 bandNo="0"&gt;&lt;COLGROUP&gt;

&lt;TR id=grdProfile_r_0 style="HEIGHT: 20px" DataKey="XXXXX3658"&gt;&lt;TD id=grdProfile_rc_0_0 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;&lt;SPAN id=fup_agentstdsearch_3765545&gt;&lt;A onclick='javascript:xfupshow("fup_agentstdsearch_3765545");' href="javascript:void(0);"&gt;&lt;IMG border=0 src="https://xchange.reged.com/ctiacom/images/flag000.gif"&gt;&lt;/A&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_1 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none" iDV="False"&gt;&lt;NOBR&gt;&lt;INPUT tabIndex=-1 onpropertychange='igtbl_chkBoxChange(event,"grdProfile");' type=checkbox&gt;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_2 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*LastName*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_3 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*FIrstName*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_4 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*MiddleName*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_5 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;3765545&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_6 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*ID*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_7 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*ID2*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_8 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_9 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;*ID3*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_10 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;*ID2*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_11 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;*Location*&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_12 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;PROD&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_13 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;0&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_14 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;7040&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_15 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_16 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_17 class="ig_2e49b359_r1 GRSHand"&gt;&lt;NOBR&gt;&lt;A onclick="viewProfile('3765545','*LastName* *FirstName*');" href="javascript:void(0);"&gt;View Profile Summary&lt;/A&gt;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_18 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_19 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_20 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;
&lt;TD id=grdProfile_rc_0_21 class="ig_2e49b359_r1 GRSHand" style="DISPLAY: none"&gt;&lt;NOBR&gt;&amp;nbsp;&lt;/NOBR&gt;&lt;/TD&gt;&lt;/TR&gt;
</code></pre>

<p>Any ideas, or am I even using dispatchEvent properly?</p>