下面的程序可以正常将表格中的文本写入文件
   Dim Tables, T As IHTMLElementCollection
   Set doc = WebBrowser1.Document   
   Set T = WebBrowser1.Document.frames(1).Document.getElementsByTagName("TABLE")  
   Set Tables = T.Item(0, 0).All.tags("Table").Item(4, 4)
     Open "C:\test.TXT" For Output As #1 
      For i = 0 To Tables.rows.length - 1
           Set ROW = Tables.rows(i)
           tmp = ""
                  For j = 0 To Tables.cells.length / Tables.rows.length - 1
                         tmp = tmp & "," & ROW.cells(j).innerText
                   Next
            Print #1, tmp                    
         Next
     Close #1
但是我想实现逐个点击表格中的每一行,查看了好多资料都没有,恳请各位给出个好主意,明确一下我应该如何实现

解决方案 »

  1.   

       Dim Tables, T As IHTMLElementCollection 
       Set doc = WebBrowser1.Document    
       Set T = WebBrowser1.Document.frames(1).Document.getElementsByTagName("TABLE")   
       Set Tables = T.Item(0, 0).All.tags("Table").Item(4, 4) 
          For i = 0 To Tables.rows.length - 1 
               Set ROW = Tables.rows(i) 
               Call ROW.click()
          Next 
      

  2.   

    Call ROW.click() 也不好用,还有别的好办法吗?
      

  3.   

    我要逐个点击每一行,点击后应该在网页的下半部分出现一个新的窗口,我要在这个窗口中传文件.但是Call ROW.click()运行后下面并没有出现窗口,没有什么变化呀.
      

  4.   

    这个是网页代码,我也看不出来什么东西,大家研究一下吧
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>
    xxxxx系统
    </title>
        <style>
            .navPoint
            {
            font-family: Webdings;
            font-size:9pt;
            color:white;
            cursor:hand;
            }
            p{
            font-size:9pt;
                }
        </style>    <script>
        function switchSysBar(){
    if (switchPoint.innerText==3){
    switchPoint.innerText=4
    document.all("frmTitle").style.display="none"
    }
    else{
    switchPoint.innerText=3
    document.all("frmTitle").style.display=""
    }
    }
        </script></head>
    <body scroll="no" style="margin: 0px">
        <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
            <tr>
                <td id="frmTitle" name="frmTitle" nowrap valign="middle" align="center">
                    <iframe id="BoardTitle" name="main" scrolling="auto" style="height: 100%; visibility: inherit; width: 250;
                        z-index: 2" frameborder="0" src="leftsubmit.aspx"></iframe>
                    <td style="width: 10pt" background="images/t2.gif">
                        <table cellspacing="0" cellpadding="0" border="0" height="100%">
                            <tr>
                                <td style="height: 100%" onclick="switchSysBar()">
                                    <span class="navPoint" id="switchPoint" title="关闭/打开左栏">3</span>
                        </table>
                    </td>
                <td style="width: 100%">
                    <iframe id="frmright" name="BoardList" style="height: 100%; visibility: inherit;
                        width: 100%; z-index: 1" scrolling="auto" frameborder="0" src="main.aspx"></iframe>
            </tr>
        </table>
    </body>
    </html>
      

  5.   

    <div class="content-box"><div class="content-box-content"><div class="tab-content default-tab" id="tab1"><table width="70%"><thead><tr><th>SKU</th><th>尺码</th><th>货品</th><th>品牌</th><th>数量</th></tr></thead><tbody><tr><td>ND20120723-1233</td><td>-</td><td><a href="/admin/product/read/id/2812">ZAMO油画真皮信封包</a></td><td><a href="/admin/brand/read/id/366">ZAMO</a></td><td>1</td></tr></tbody></table></div></div><!-- End .content-box-content --></div>用VB 如何获取这个没有ID 或 name的 table数据 谢谢大家!!!