2016-06-01 14 views
0

ich kann nicht herausfinden klicken, wie die auf dieser Seite "Next 100" klicken:Excel VBA - Makro auf die nächste Seite in IE

http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0000898293&type=&dateb=&owner=exclude&count=100

speziell in diesem Abschnitt:

<form> 
    <table border="0" width="100%"> 
     <tbody><tr> 
      <td>Items 1 - 100&nbsp;&nbsp;<a href="/cgi-bin/browse-edgar?action=getcompany&amp;CIK=0000898293&amp;type=&amp;dateb=&amp;owner=exclude&amp;start=0&amp;count=100&amp;output=atom"><img src="/images/rss-feed-icon-14x14.png" alt="0000898293 Filings" border="0" align="top"> RSS Feed</a></td> 
      <td style="text-align: right;"> <input type="button" value="Next 100" onclick="parent.location='/cgi-bin/browse-edgar?action=getcompany&amp;CIK=0000898293&amp;type=&amp;dateb=&amp;owner=exclude&amp;start=100&amp;count=100'"></td> 
     </tr> 
    </tbody></table> 
    </form> 

Unten ist, was ich in Excel VBA müde habe, ich habe kein starkes Verständnis davon und weiß, wie man auf eine Schaltfläche klickt, wenn ich die Element-ID sehen kann.

Sub dates()Dim IE As New InternetExplorer 
IE.Visible = True 

IE.navigate "http://www.sec.gov/cgi-bin/browse-edgar?CIK=JBL&owner=exclude&action=getcompany" 
Do 
DoEvents 
Loop Until IE.readyState = READYSTATE_COMPLETE 
Dim Doc As HTMLDocument 
Set Doc = IE.document 


Doc.getElementById("count").Value = 100 
Doc.forms.Item(0).submit 


Dim objTag As Object 
For Each objTag In Doc.getElementsByTagName(strTagName) 
If InStr(objTag.outerHTML, "Next 100") > 0 Then 

    objTag.Click 
    objTag.FireEvent ("onclick") 

    Exit For 

End If 
Next 

Antwort

1

Dies sollte für Sie arbeiten:

Sub dates() 
    Dim IE As New InternetExplorer 

    Set IE = CreateObject("InternetExplorer.Application") 

    IE.Visible = True 
    IE.Navigate "http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0000898293&type=&dateb=&owner=exclude&count=100" 

    Do 
     DoEvents 
    Loop Until IE.ReadyState = READYSTATE_COMPLETE 

    With IE.document 
     Set elems = .getElementsByTagName("input") 
     For Each e In elems 
      If e.Type = "button" And e.Value = "Next 100" Then 
       e.Click 
       Exit For 
      End If 
     Next e 
    End With 
End Sub 

Wenn Sie folgenden Link verwenden:

http://www.sec.gov/cgi-bin/browse-edgar?CIK=JBL&owner=exclude&action=getcompany 

Sie für

If objCollection(i).Type = "button" And objCollection(i).Value = "Next 40" Then 
überprüfen