How do I get data from web access web content in Excel?

How to extract data from website with login to Excel?

I want to extract data from a website and I have an excel file with the login.

I can view the html file without logging in.

However when I login it gives an error. This is the code I have been trying to get data from: Sub Log(). Dim Url As String. Dim html As Object. Set fso = CreateObject("Scripting.FileSystemObject") Dim xmldoc As Object, htmlDoc As Object. Url = "". Set fso = CreateObject("Scripting.FileSystemObject") Set xmldoc = CreateObject("Msxml2.DOMDocument.3.0")
Set htmlDoc = CreateObject("Msxml2.HTMLWG.HTMLDocument")
With xmldoc. .async = False .Load (Url) End With. htmlDoc.Async = False htmlDoc.open htmlDoc.setProperty "SelectionLanguage", "XPath" htmlDoc.setProperty "SelectionNamespaces", "xmlns:a=' xmlns:b='urn:schemas-microsoft-com:office:spreadsheet' xmlns:c='urn:schemas-microsoft-com:office:excel'" htmlDoc.setProperty "CacheBrowser", "True" htmlDoc.setProperty "PreFilterExtractAll", "True" htmlDoc.LoadXML (.DocumentElement.xml)
htmlDoc.Save "C:UsersRohunDesktopTEST FILEtest1.

How do I get data from web access web content in Excel?

I'm writing a macro in Excel to pull data from a website.

The data is organized into tables on the site. I need to extract the data and organize it into rows and columns.

I've been trying to use a web query but I can't seem to get it to work. Any suggestions? Sub GetData(). Dim ie As InternetExplorer, x As Long, ln As Long. Dim sURL As String. SURL = "". Set ie = New InternetExplorer. With ie. .Visible = True .navigate sURL While .Busy Or .readyState < 4: DoEvents: Wend

With .document ln = .querySelectorAll("tr")(1).Length
x = 1. For Each tr In .querySelectorAll("tr") For Each td In .querySelectorAll("td") Debug.Print .querySelectorAll("td").