Sub WebMail()
'reference: Microsoft Internet Controls
'reference: Microsoft HTML Object Library
Dim mIE As InternetExplorer
Dim Item_link As HTMLLinkElement
Dim Item_form As HTMLFormElement
Set mIE = New InternetExplorer
mIE.Visible = True
mIE.Navigate "www.yahoo.com"
Do Until mIE.readyState = READYSTATE_COMPLETE
Loop
For Each Item_link In mIE.Document.Links
If Item_link.innerHTML = "My Mail" Then
mIE.Navigate Item_link
Exit For
End If
Next Item_link
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
Do Until mIE.readyState = READYSTATE_COMPLETE
Loop
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
For Each Item_form In mIE.Document.forms
For Each Item2 In Item_form.all
a = "none"
On Error Resume Next
a = Item2.Name
On Error GoTo 0
If a = "login" Then
Item2.Value = "USERID"
ElseIf a = "passwd" Then
Item2.Value = "PASSWORD"
End If
Next Item2
Item_form.submit
Next Item_form
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
Do Until mIE.readyState = READYSTATE_COMPLETE
Loop
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
For Each Item_link In mIE.Document.Links
If Item_link.innerHTML = "Compose" Then
mIE.Navigate Item_link
Exit For
End If
Next Item_link
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
Do Until mIE.readyState = READYSTATE_COMPLETE
Loop
tmr = Timer()
Do Until Timer() - tmr > 1
Loop
For Each Item_form In mIE.Document.forms
For Each Item2 In Item_form.all
a = "none"
On Error Resume Next
a = Item2.Name
On Error GoTo 0
Select Case a
Case "To"
Item2.Value = "Email Address Here"
Case "Cc"
' item2.Value = "Carbon Copy Here"
Case "Bcc"
' item2.Value = "Blind Carbon Copy Here"
Case "Subj"
Item2.Value = "Message Subject here"
End Select
cnt = cnt + 1
Next Item2
' Item.submit
Next Item_form
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "Body Here", True
' 'the submit method does't work... not sure how to send the mail once the message is composed
' mIE.Document.forms("Compose").submit
'
' 'but this will sign you out and close the window
' For Each Item_link In mIE.Document.Links
'
' If Item_link.innerhtml = "Sign Out" Then
'
' mIE.Navigate Item_link
'
' Exit For
'
' End If
'
' Next Item_link
'
' tmr = Timer()
'
' Do Until Timer() - tmr > 1
'
' Loop
'
' Do Until mIE.readyState = READYSTATE_COMPLETE
'
' Loop
'
' tmr = Timer()
'
' Do Until Timer() - tmr > 1
'
' Loop
'
'
' mIE.Quit
'
' Set mIE = Nothing
End Sub