vba excel从ierame

时间:2016-04-29 18:40:29

标签: vba excel-vba excel

任何人都可以建议我如何从嵌套iframe获取数据... 在下面我有两个iframe,并希望从第二个iframe获取innertext(嵌套在第一个iframe中,还有另一个ifrmae),下面是我尝试过的但是它没有从任何一个iframe中提供任何文本或信息。 VB excel中的监视窗口显示为拒绝访问..

For Each Bdoc7 In BDoc.getElementsByTagName("iframe")(0).document.all
   Set BDoc1 = Bdoc7.document
   Exit For
Next Bdoc7
b = BDoc1.all.Length
For Each BDoc5 In BDoc1.getElementsByTagName("iframe")(1).document.all
  Set BDoc2 = BDoc5.document
  Exit For
Next BDoc5
c = BDoc2.all.Length
For Each l In BDoc1.getElementById("content")
  a = l.innerText
  If LCase(l.innerText) = "post" Then
    MsgBox "found"
  End If
Next l

在上面,b和c的长度返回相同的..

下面是第一个iframe,我甚至无法进入innertext" Listings"在标题标签下(下面的最后一行)

<iframe width="100%" height="640" src="https://business.com/users/corplogin?accountid=89502&amp;code=0011245&amp;timestamp=ghy78&amp;sign=5fa5e4c03a5c28dc820d32a5p;nav=listings" frameborder="0" scrolling="auto"></iframe>
<html class="gt-ie8"><!--<![endif]--><head><style>.mqacopyright{font-family:sans-serif;font-size:9px;white-space:nowrap;} .mqacopyrightlight{color:white;font-weight:bold;} .mqacopyrightdark{color:black;font-weight:bold;} .mqacopyright .mqacopyswitch{display:none;} .mqacopyrightlight .mqacopyswitchlight{display:inline;} .mqacopyrightdark .mqacopyswitchdark{display:inline;}</style><style>.scale_bar{background-color:#fff; border:1px solid #000; position:absolute; z-index:22; overflow:hidden; height: 12px; opacity:0.75; -moz-border-radius:2px; -webkit-border-radius:2px;}.scale_text{position:relative; left:3px; top:-1px; overflow:hidden; color:#000; font-family:Arial,sans-serif; font-size:10px;}</style>

<title>Listings</title>

0 个答案:

没有答案