In the following code we are using IE Automation to get from here
Location 1
"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=" & Ticker & "&type=10-Q&dateb=&owner=exclude&count=20"
to a location like this
Location 2
https://www.sec.gov/Archives/edgar/data/10795/000119312514042815/bdx-20131231.xml
Is there a way to go from location 1 to location 2 without using IE Automation and finding something more reliable, secure and faster?
For reasons of completeness here is the full code we have by now; by running you will see heavy use of IE:
Option Explicit
Sub MadMule2()
Dim IE As InternetExplorer
Dim el
Dim els
Dim colDocLinks As New Collection
Dim Ticker As String
Dim lnk
Dim intCounter as Integer
Set IE = New InternetExplorer
IE.Visible = False
Ticker = Worksheets("Sheet1").Range("A1").Value
LoadPage IE, "https://www.sec.gov/cgi-bin/browse-edgar?" & _
"action=getcompany&CIK=" & Ticker & "&type=10-Q" & _
"&dateb=&owner=exclude&count=20"
Set els = IE.document.getElementsByTagName("a")
For Each el In els
If Trim(el.innerText) = "Documents" Then
colDocLinks.Add el.href
End If
Next el
intCounter = 1
For Each lnk In colDocLinks
LoadPage IE, CStr(lnk)
For Each el In IE.document.getElementsByTagName("a")
If el.href Like "*[0-9].xml" Then
ActiveWorkbook.XmlMaps.Add(el, "xbrl").Name = "xbrl Map"
End If
Next el
Next lnk
End Sub
Sub LoadPage(IE As InternetExplorer, URL As String)
IE.navigate URL
Do While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub
ADDITIONAL
Q: Is there a way to go from location 1 to location 2 without using IE Automation and finding something more reliable, secure and faster?
Can you expand on this?
By mehow
A: Here is a comment for the code block we have received by user2140261 here:
You should look into MSXML it is much faster, secure, and reliable then IE automation.
Since the code opens Internet Explorer, parses the source page to find the href and get to the Web location needed; we wondered if there is a way to go into location 2 without the use of IE. Can it be done with MSXML as user2140261 states?