Hey guys,
I'm using the following code to login to gmail, which works perfectly. What I want to know is how to know if there are any new emails in your inbox.
Here's the code:
[vba]Sub GMAIL(MyLogin As String, MyPass As String)
Dim ie As Object
Dim ieForm As Variant
Dim WebPage As String
Set ie = CreateObject("InternetExplorer.Application")
WebPage = "http://mail.google.com"
ie.Visible = True
ie.Navigate WebPage
'Loop until IE pages is fully loaded
Do Until ie.ReadyState = 4 'READYSTATE_COMPLETE
Loop
'Look for userform Form by finding test "Userform"
For Each ieForm In ie.Document.forms
'Debug.Print ieForm.innertext
If InStr(ieForm.innertext, "Username") <> 0 Then
ieForm(0) = MyLogin
ieForm(1) = MyPass
ieForm.submit
End If
Next
Set ie = Nothing
End Sub[/vba]
Now, that may sound difficult....but all I need to do is be able to read the window's full caption and I'll be able to tell right away because the caption (when you have mail) is:
Gmail - Inbox(1) - Microsoft Internet Explorer
so I can just check out the caption for a number and find out how many new emails I have (if any).
Problem is, I can't find the right property to display the full window name (or seperately "Inbox(1)"). The only things I found were:
ie.Name - which turns up "Microsoft Internet Explorer"
ie.LocationName - which says "Gmail"
And others that point to website addresses or application paths.
Any ideas?
Thanks