Excel VBA网页抓取 – 定位一个不同的框架

我想从网站上取下一些数据并放入excel。 我已经完成了这之前&代码编写,login我浏览到我想要的页面。

在这一点上,网站是在不同的格式。 我想要的页面有框架。 顶部框架有一个横幅和一些文字,然后在底部框架中有一个表格。 当我在我的VBA代码浏览到这一点,它似乎只能find顶部框架 – 没有forms等。我如何专门针对框架的forms?

HTML源代码:

<html> <head> <title></title> <link rel="stylesheet" type="text/css" href="../custom/LeftSideSquareTabs.css"> <script type="text/javascript" language="javascript" src="../include/JSCommon.js"></script> <Script language="JavaScript"> function Dummmy() { parent.location.replace('../login.asp?Locale=EN&Lo=1') } </script> </head> <body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="10"> <table border="0" cellpadding="0" cellspacing="0" width="786"> <tr> <td width="50%" align="left" height="62"></td> <td width="50%" align="right" height="62"> <a href="http://www.website.com" target="_blank"> <img name="ToolbarRightLogo" src="../custom/ToolbarlogoRight.gif" border="0" alt="MMIA version 5.1.0"> </a> </td> </tr> </table> <table width="786" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="TabsOff" onclick="dispayMen();">Option A</td> <td class="TabsImage"><img src="../images/TabOff.gif" width="4" height="17"></td> <td><img src="../images/spacer.gif" width="1" height="1"></td> <td class="TabsOn">Option B<</td> <td class="TabsImage"><img src="../images/TabOn.gif" width="4" height="17"></td> <td><img src="../images/spacer.gif" width="1" height="1"></td> <td><img src="../images/spacer.gif" width="466" height="1" WIDTH="1" HEIGHT="1"></td> <td class="SupportOff" onMouseOver="this.className='SupportOver'" onMouseOut="this.className='SupportOff'" onclick="LogOutSession()">Log out</td> <a href="mailto:support@xxxxx.com"><td class="Support" onMouseOver="this.className='SupportO'" onMouseOut="this.className='Support'">Contact</td></a> <td><img src="../images/spacer.gif" width="10" height="1"></td> </tr> <tr> <td class="TabsOffBottom" colspan="2"><img src="../images/spacer.gif" width="1" height="1"></td> <td class="TabsOnBottom" colspan="3"><img src="../images/spacer.gif" width="1" height="1"></td> <td class="TabsOffBottom" colspan="7"><img src="../images/spacer.gif" width="1" height="1"></td> </tr> </table> <table class="TabsOnBottom" width="786" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td> <td><img src="../images/spacer.gif" width="9" height="8"></td> <td class="MiddleToolbarText" width="526">Option B</td> <td class="MiddleToolbarRightText" width="185">Updated to:&nbsp;</td> <td class="MiddleToolbarText" width="55">11-02-2015</td> <td><img src="../images/spacer.gif" width="9" height="1"></td> <td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td> </tr> </table> <table class="TabsOnBottom" width="786" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td> </tr> </table>' 

这个简单的解决scheme有窍门。 (通过试验和错误,我找出了我想操作帧1的框架)。

 Set ieDoc = doc.frames(1).document