I have the following code which is doing some collecting of data from webpages. My questions is why does the code 'work' as I expect with the 'CALL' statement, but doesn't work without it...
Dim matchURL As String
Dim FixtureDetailsTab As HTMLTable
For Each match In FixtureCollection
matchURL = match.getMatchURL
'
' Load up the match table
'
oXML.Open "GET", matchURL, False
oXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXML.send
Set htmlDoc = New MSHTML.HTMLDocument
Set htmlBody = htmlDoc.body
htmlBody.innerHTML = oXML.responseText
'
' And once again look for the elements with class 'engineTable'
' (only interested in the first one)
'
Set Elements = htmlDoc.getElementsByClassName("engineTable")
For Each element In Elements
Set FixtureDetailsTab = element
Exit For
Next element
Call match.addDetails(FixtureDetailsTab)
Next match
match is a custom class in a separate Class Module, and 'addDetails' is defined as follows
Public Sub addDetails(detailTab As HTMLTable)
....
End Sub
The code above works, but if I remove the call statement and just try and invoke the Sub as below
match.addDetails (FixtureDetailsTab)
I get 'Run time error 13' - Type mismatch
I'm puzzled. Any help appreciated.
Thanks