help with HTML

T

thomas donino

Excel 2007 sp2

This routine runs an automated download and print pdf's each morning

The following code snippet is getting a compile error on the line
strWebHTML2= .Document.body.innerhtml

It works fine for the identical code above it.

the second part of the code is to handle the minor instances where the
Re-Logon screen pops up

'check to see if I am already logged in, if not then log in
strWebHTML = .Document.body.innerhtml
If InStr(1, strWebHTML, "Please Login", vbTextCompare) > 0 Then
Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_userid")
ipf.Value = strUser

Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_password")
ipf.Value = strPass

Set ipf = .Document.all.Item("id")

Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_ibGo")
ipf.Select
ipf.Click
End If
End With
'If that darn relogon box comes up
strWebHTML2 = .Document.body.innerhtml
If InStr(1, strWebHTML2, "Elliott Wave International - Login",
vbTextCompare) > 0 Then
Set ipf = .Document.getElementById( _
"userid")
ipf.Value = strUser

Set ipf = .Document.getElementById( _
"password")
ipf.Value = strPass

Set ipf = .Document.all.Item("id")

Set ipf = .Document.getElementById( _
"ibGo")
ipf.Select
ipf.Click
End If
End With
 
P

Patrick Molloy

you have

End With
'If that darn relogon box comes up
strWebHTML2 = .Document.body.innerhtml

there mustt be a WITH as = .Document.body.innerhtml is an object method
suggest you try remming out the "end with" above this line
 
J

Jacob Skaria

Your entire code should be within the With/End With statements...as below

Sub Macro()
Set IE = CreateObject("InternetExplorer.Application")
With IE

' all your code here

End With
End Sub

If this post helps click Yes
 
T

thomas donino

Thats why two sets of eyes are better, thank you

Patrick Molloy said:
you have

End With
'If that darn relogon box comes up
strWebHTML2 = .Document.body.innerhtml

there mustt be a WITH as = .Document.body.innerhtml is an object method
suggest you try remming out the "end with" above this line
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top