PC Review


Reply
Thread Tools Rate Thread

CreateObject Software Versions

 
 
Walter Briscoe
Guest
Posts: n/a
 
      10th Jul 2011
I run Excel 2003 SP3 on Windows Vista Business SP2 and IE8.

The code below works in 2 different ways for 2 users on one machine.
I think 'CreateObject("InternetExplorer.Application")' grabs a default
version of the code which maps an HTML page to the Document Object Model
(DOM). My code has inconsistent behavior as a result.

I can fix this. Rather than refer to
IE.Document.ChildNodes.Item(1).ChildNodes.Item(1).ChildNodes.Item(5) ...
Doc.getelementbyid("stations") is fairly close to what I want to read.

OTOH, it seems unhelpful to specify an OLE access object ambiguously.
A couple of months ago, I hit a similar problem and restored IE8 rather
than use IE9.

How do I find and control the version loaded?
'CreateObject("InternetExplorer.Application.1")' does not help.

P.S. The Locals Window seems weakly equipped. I can't use Ctrl+A and
Ctrl+C to put its contents in the clipboard as text. I suppose I could
try Print Screen to take a picture. I want to be able to compare the
different versions. Does anybody know of software which will produce a
structured dump of an arbitrary variable?

' This shows different behavior for 2 versions of "InternetExplorer.Application"
' Both are seen for two users of one Vista machine
' For one version, the following is written to the immediate window and an error is shown
' V = 1 T.Length = 2 TypeName(T.Item(V)) = HTMLHtmlElement
' V = 1 T.Length = 2 TypeName(T.Item(V)) = HTMLBody
' V = 2 T.Length = 12 TypeName(T.Item(V)) = HTMLCommentElement
'
' For the other version, the following is written and the code succeeds:
' V = 1 T.Length = 2 TypeName(T.Item(V)) = HTMLHtmlElement
' V = 1 T.Length = 2 TypeName(T.Item(V)) = HTMLBody
' V = 2 T.Length = 10 TypeName(T.Item(V)) = HTMLDivElement
' V = 5 T.Length = 25 TypeName(T.Item(V)) = HTMLDivElement
' V = 8 T.Length = 13 TypeName(T.Item(V)) = HTMLDivElement
' V = 5 T.Length = 6 TypeName(T.Item(V)) = HTMLUListElement
' V = 0 T.Length = 2 TypeName(T.Item(V)) = HTMLLIElement
' V = 1 T.Length = 2 TypeName(T.Item(V)) = HTMLUListElement

Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) ' Allows URL speed control

#If True Then
Dim IE As Object
#Else
Dim IE As SHDocVw.InternetExplorer ' Needs Tools/References/Microsoft Internet Controls
#End If

Dim Doc As Object ' IE.Document

Public Sub ShowIE()
Dim O As Object

TxURL "http://www.tfl.gov.uk/tfl/livetravelnews/realtime/track.aspx?offset=1"
Set O = GetBranch(Doc, 1, 1, 2, 5, 8, 5, 0, 1)
End Sub

Private Sub TxURL(ByVal URL1 As String)
Set IE = CreateObject("InternetExplorer.Application")
Debug.Assert Not IE Is Nothing
IE.Visible = True

IE.Navigate2 URL1
Wait4IE
Set Doc = IE.document
End Sub

Private Sub Wait4IE()
Do
Sleep 50
DoEvents
Loop While IE.Busy Or IE.ReadyState <> 4 ' READYSTATE_COMPLETE
End Sub

Private Function GetBranch(ByVal O As Object, ParamArray Path() As Variant) As Object
Dim T As Object
Dim V As Variant

Set T = O.childnodes
For Each V In Path
Debug.Print "V = " & V, "T.Length = " & T.Length, _
"TypeName(T.Item(V)) = " & TypeName(T.Item(V))
Set T = T.Item(V).childnodes
Next V
Set GetBranch = T
End Function

--
Walter Briscoe
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Comparison of OEM and Retail Versions of software? Darrell Gorter[MSFT] Windows XP Setup 1 12th Jan 2005 02:49 AM
OEM Versions Of Software Windows XP General 7 22nd Jul 2004 04:56 PM
How to programmatically check for versions of software Jak Sparrow Microsoft C# .NET 2 14th Jul 2004 06:15 PM
Software licensing and OEM versions Martyn Windows XP General 4 20th Jan 2004 11:24 AM
newer versions of AV software? Dudhorse Anti-Virus 7 19th Aug 2003 02:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:44 AM.