I tried to read a html file which is in my local hard drive. It didnt work. I have enabled ActiveX controls and plug-ins.
Here is the code. If you change to the first URL, it works ok.
Sub ReadHtmlPage()
Dim IE As Object
URL = "Supersää" ' this URL works
URL = "d:\example.html" ' this does not work
Set IE = CreateObject("InternetExplorer.Application")
IE.Silent = True
IE.Visible = True
IE.FullScreen = False
IE.Navigate URL
Application.Wait (Now + TimeValue("0:00:02"))
Do Until (IE.ReadyState = 4 And Not IE.Busy)
DoEvents
Loop
IE.ExecWB 17, 2
IE.ExecWB 12, 0
Worksheets("Data").Activate
ActiveSheet.Cells.Clear
ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
End Sub
Here is the code. If you change to the first URL, it works ok.
Sub ReadHtmlPage()
Dim IE As Object
URL = "Supersää" ' this URL works
URL = "d:\example.html" ' this does not work
Set IE = CreateObject("InternetExplorer.Application")
IE.Silent = True
IE.Visible = True
IE.FullScreen = False
IE.Navigate URL
Application.Wait (Now + TimeValue("0:00:02"))
Do Until (IE.ReadyState = 4 And Not IE.Busy)
DoEvents
Loop
IE.ExecWB 17, 2
IE.ExecWB 12, 0
Worksheets("Data").Activate
ActiveSheet.Cells.Clear
ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
End Sub