From: Norm on
Hi,

I am using the following code to open a page to sign in to MyMsn and it
does not work in the same way as other secure sites do. I don't know if
Microsoft does something different(big grin here), but the code, which
I believe I got from Karl Peterson, shows 22 objects on the document,
but does not print anything for the obj type, obj name or obj value.
Passing the document to a timer to run HTML links does not show the
sign in boxes at all either. Is there another way to see the items on
this page and pass the email address and password to them?

Code:


Private Sub Form_Load()
Dim obj

Set Explorer = New InternetExplorer
Explorer.Navigate2 "http://my.msn.com/"


End Sub


Private Sub Explorer_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
Dim obj
Dim i As Long
i = 0

If pDisp Is Explorer Then
'Debug.Print vbCrLf; "TYPE", "NAME", "VALUE"
For Each obj In Explorer.Document.All()
Debug.Print obj.Type, obj.Name, obj.Value
i = i + 1
Next
Debug.Print "i = " & i
If Not Explorer.Document Is Nothing Then Set Doc =
Explorer.Document
Timer1.Enabled = True
End If

End Sub

Private Sub Timer1_Timer()
Dim oTag As HTMLLinkElement
Dim i As Long
Me.Timer1.Enabled = False
i = 0

For Each oTag In Doc.links
i = i + 1
Debug.Print oTag.innerText
Next

Debug.Print "oTag i = " & i
Unload Me
End Sub

Thanks Norm


From: Mike S on
On 7/26/2010 4:25 PM, Norm wrote:
> Hi,
>
> I am using the following code to open a page to sign in to MyMsn and it
> does not work in the same way as other secure sites do. I don't know if
> Microsoft does something different(big grin here), but the code, which I
> believe I got from Karl Peterson, shows 22 objects on the document, but
> does not print anything for the obj type, obj name or obj value. Passing
> the document to a timer to run HTML links does not show the sign in
> boxes at all either. Is there another way to see the items on this page
> and pass the email address and password to them?
>
> Code:
>
>
> Private Sub Form_Load()
> Dim obj
>
> Set Explorer = New InternetExplorer
> Explorer.Navigate2 "http://my.msn.com/"
>
>
> End Sub
>
>
> Private Sub Explorer_DocumentComplete(ByVal pDisp As Object, URL As
> Variant)
> Dim obj
> Dim i As Long
> i = 0
>
> If pDisp Is Explorer Then
> 'Debug.Print vbCrLf; "TYPE", "NAME", "VALUE"
> For Each obj In Explorer.Document.All()
> Debug.Print obj.Type, obj.Name, obj.Value
> i = i + 1
> Next
> Debug.Print "i = " & i
> If Not Explorer.Document Is Nothing Then Set Doc = Explorer.Document
> Timer1.Enabled = True
> End If
>
> End Sub
>
> Private Sub Timer1_Timer()
> Dim oTag As HTMLLinkElement
> Dim i As Long
> Me.Timer1.Enabled = False
> i = 0
>
> For Each oTag In Doc.links
> i = i + 1
> Debug.Print oTag.innerText
> Next
>
> Debug.Print "oTag i = " & i
> Unload Me
> End Sub
>
> Thanks Norm


How about this approach:
- the project contains these references
Microsoft Internet Controls
Microsoft HTML Object Library
- input element iteration code found here:

http://www.vbmonster.com/Uwe/Forum.aspx/basic/7680/Internet-Explorer-Automation-with-VB6-Click-Buttons-Enter-Passwords

Private Sub btnOpenNewIE_Click()
Dim n As Long
Dim oCol As IHTMLElementCollection
Dim oElement As IHTMLElement
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate2 "http://my.msn.com/"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Sleep 100
DoEvents
Loop
Form1.Caption = "page load complete"
DoEvents
Set oCol = IE.Document.All.tags("INPUT")
For Each oElement In oCol
Debug.Print oElement.className & " " & oElement.Name
Next
End Sub


From: Norm on
Mike S formulated the question :
> On 7/26/2010 4:25 PM, Norm wrote:
>> Hi,
>>
>> I am using the following code to open a page to sign in to MyMsn and it
>> does not work in the same way as other secure sites do. I don't know if
>> Microsoft does something different(big grin here), but the code, which I
>> believe I got from Karl Peterson, shows 22 objects on the document, but
>> does not print anything for the obj type, obj name or obj value. Passing
>> the document to a timer to run HTML links does not show the sign in
>> boxes at all either. Is there another way to see the items on this page
>> and pass the email address and password to them?
>>
>> Code:
>>
>>
>> Private Sub Form_Load()
>> Dim obj
>>
>> Set Explorer = New InternetExplorer
>> Explorer.Navigate2 "http://my.msn.com/"
>>
>>
>> End Sub
>>
>>
>> Private Sub Explorer_DocumentComplete(ByVal pDisp As Object, URL As
>> Variant)
>> Dim obj
>> Dim i As Long
>> i = 0
>>
>> If pDisp Is Explorer Then
>> 'Debug.Print vbCrLf; "TYPE", "NAME", "VALUE"
>> For Each obj In Explorer.Document.All()
>> Debug.Print obj.Type, obj.Name, obj.Value
>> i = i + 1
>> Next
>> Debug.Print "i = " & i
>> If Not Explorer.Document Is Nothing Then Set Doc = Explorer.Document
>> Timer1.Enabled = True
>> End If
>>
>> End Sub
>>
>> Private Sub Timer1_Timer()
>> Dim oTag As HTMLLinkElement
>> Dim i As Long
>> Me.Timer1.Enabled = False
>> i = 0
>>
>> For Each oTag In Doc.links
>> i = i + 1
>> Debug.Print oTag.innerText
>> Next
>>
>> Debug.Print "oTag i = " & i
>> Unload Me
>> End Sub
>>
>> Thanks Norm
>
>
> How about this approach:
> - the project contains these references
> Microsoft Internet Controls
> Microsoft HTML Object Library
> - input element iteration code found here:
>
> http://www.vbmonster.com/Uwe/Forum.aspx/basic/7680/Internet-Explorer-Automation-with-VB6-Click-Buttons-Enter-Passwords
>
> Private Sub btnOpenNewIE_Click()
> Dim n As Long
> Dim oCol As IHTMLElementCollection
> Dim oElement As IHTMLElement
> Set IE = CreateObject("InternetExplorer.Application")
> IE.Visible = True
> IE.Navigate2 "http://my.msn.com/"
> Do While IE.ReadyState <> READYSTATE_COMPLETE
> Sleep 100
> DoEvents
> Loop
> Form1.Caption = "page load complete"
> DoEvents
> Set oCol = IE.Document.All.tags("INPUT")
> For Each oElement In oCol
> Debug.Print oElement.className & " " & oElement.Name
> Next
> End Sub

Mike,

Thanks for the information. I tried that and it worked until I signed
in once and then it would only show the first button and the page had
my email address already included, even though I have all autocomplete
in IE unchecked. There seems to be something different on Microsofts
site.

I used to just save the cookies and it would automatically signin, but
that appears to only work for one day now and then you have to sign in
again. The security on this site seems to be greater than my bank. ;-)

I will keep playing with it, but will probably just use FireFox as that
still remembers my cookies. :-Z

Norm


From: Norm on
Not sure what I was doing wrong, but it is working now. :D

If I delete all cookies from the cookie folder and the Temporary
Internet Folder it will open correctly to the sign in page. If I leave
the cookies it will open to My Msn page. At least for today. ^^

I will see what it does tomorrow.

Thanks again,
Norm


From: Mike S on
On 7/26/2010 6:47 PM, Norm wrote:
> Not sure what I was doing wrong, but it is working now. :D
>
> If I delete all cookies from the cookie folder and the Temporary
> Internet Folder it will open correctly to the sign in page. If I leave
> the cookies it will open to My Msn page. At least for today. ^^
>
> I will see what it does tomorrow.
>
> Thanks again,
> Norm

Norm,

How about setting up IE delete cookies and temporary files when it is
closed?

http://www.mvps.org/winhelp2002/delcache.htm

Mike