Yes I am aware that this question will be very simular to my other question.
In my other question I asked about htmlp.
before I used that I tried to work with delphi's own units.
My code was like this:
procedure DesectTable(L:TStrings);
var
doc:OleVariant;
el:OleVariant;
i:integer;
begin
doc := coHTMLDocument.Create as IHTMLDocument2;
doc.write(L.Text);
doc.close;
for i:=0to doc.body.all.length-1 do // Breaks here
begin
el:=doc.body.all.item(i);
if el.tagname='TR' then
begin
if (el.classname='even') or (el.classname='odd') then
writeln(el.innerhtml);
end;
end;
end;
This is code I used in another project where it did work.
But in this function I get an error:
Project F1Times.exe raised exception class EVariantInvalidOpError with message 'Invalid variant operation'
Does anyone know what could cause this?
And why does it happen here but not in my other project?
Yes, both functions are identical except for the part what happens inside of the for loop.
I'd like to know, this is so confusing xD
Edit
In case anyone would like to test this. The html im trying to fetch can be found here I saved that for easier testing and simply used a stringlist.loadfromfile.