LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Early binding problem

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
From Early binding to Late binding Henk Excel Programming 1 February 12th 09 11:37 AM
Dumb early binding question Nicole Seibert Excel Programming 3 July 17th 06 05:20 AM
Early and Late Binding Vba Excel VJ Excel Programming 7 April 7th 05 06:05 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
Early vs Late Binding - Word John Wilson Excel Programming 6 November 13th 03 03:21 PM


All times are GMT +1. The time now is 06:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"