Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have become convinced that early binding is "a good thing".
My technique for applying it is to declare a variable with type Object, use typename to find the type and then redeclare the variable with that type. However, that sometimes fails for no reason I can understand. This is a cut-down example: Public Sub TypeChange() Const URL As String = "journeyplanner.tfl.gov.uk/user/" & _ "XSLT_TRIP_REQUEST2?language=en&sessionID=0" & _ "&type_origin=stop&name_origin=ANGEL" & _ "&type_destination=stop&name_destination=BANK" Dim Tables As Object ' Array of tables in ie.document ' DispHTMLElementCollection gets assignment error TxURL URL ' Connect to application.internetexplorer and set Doc Set Tables = Doc.getElementsByTagName("Table") Debug.Print TypeName(Tables) End Sub This shows that Tables is set as a DispHTMLElementCollection If I redeclare Tables As DispHTMLElementCollection, the set statement fails with a Run-time error '13': Type mismatch. Why? How do I get types of methods? How do I get the definition of DispHTMLElementCollection? (I can easily get member types with View\Locals Window.) My hypothesis is that getElementsByTagName is declared to return a more general type than DispHTMLElementCollection and that type mismatches. This smaller example does not show the problem.;( Dim Origin As DispHTMLElementCollection Dim Destination As DispHTMLElementCollection Set Destination = Origin Light, please? ;) -- Walter Briscoe |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
From Early binding to Late binding | Excel Programming | |||
Dumb early binding question | Excel Programming | |||
Early and Late Binding Vba Excel | Excel Programming | |||
EARLY binding or LATE binding ? | Excel Programming | |||
Early vs Late Binding - Word | Excel Programming |