Link to home
Start Free TrialLog in
Avatar of tanmay kadam
tanmay kadam

asked on

VBA To Read HTML File Not Working

I have been trying to follow the videos and extract data from an HTML file and I was able to do so on my system. BUT when I try to use the same code/module to extract data from the html file from my Friend's system it shows me an "error 91: object variable or with block not set" at line 2 and sometime even at line 1. Basically it is not reading the html document on a different system. The HTMLButton1  when tried in debug.print show nothing
Dim file As String
Dim IE As New SHDocVw.InternetExplorerMedium
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLButton1


file = "C:\temp\HTML\page1.html"

IE.Visible = False
IE.navigate file 'line 1
Do While IE.Busy = True
Loop

Set HTMLDoc = IE.Document
Set HTMLButton1 = HTMLDoc.elementFromPoint(338, 462)


array_objects(index).date = HTMLButton1.innerText 'line2


IE.Quit
Set IE = Nothing

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial