Sorry p45cal, I was in transit to the office
The code is below, less the real user pass, and i ended it at the point
where it brings the pdf up in IE
Sub AutomateMornTasks()
Dim ie As InternetExplorer
Dim RegEx As RegExp, RegMatch As MatchCollection
Dim strMainPathdfj As String
Dim strFiletoFind As String
Dim strMainPathstu As String
Dim strDatePart As String
Dim PrinterToUse As String
Dim strNetworkPrinter As String
Dim ipf As Object
Dim Username As String
Dim password As String
Dim my_var As String
Username = "xxxx"
password = "xxxx"
Set ie = New InternetExplorer
Set RegEx = New RegExp
strMainPathdfj = "
http://www.elliottwave.com/dfj/archives/"
strMainPathstu = "
http://www.elliottwave.com/stu/archives/"
'open Internet Explorer, navigate to Ewave site
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.Navigate "
www.elliottwave.com/"
Do While .ReadyState <> 4 Or _
.Busy = True
Loop
'check to see if I am already logged in, if not then log in
my_var = .Document.body.innerhtml
If InStr(1, my_var, "Please Login", vbTextCompare) > 0 Then
Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_userid")
ipf.Value = Username
Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_password")
ipf.Value = password
Set ipf = .Document.all.Item("id")
Set ipf = .Document.getElementById( _
"ewiHeader_ucEwiLogin_ibGo")
ipf.Select
ipf.Click
End If
End With
'create string for filename
If Weekday(Date) = 1 Then
strDatePart = Replace(Format(Date - 2, "mmdd"), "/", "")
strFiletoFind = strMainPathdfj & strDatePart & "dfjww" & ".pdf"
Else
If Weekday(Date) = 7 Then
strDatePart = Replace(Format(Date - 1, "mmdd"), "/", "")
strFiletoFind = strMainPathdfj & strDatePart & "dfjww" & ".pdf"
Else
strDatePart = Replace(Format(Date, "mmdd"), "/", "")
strFiletoFind = strMainPathdfj & strDatePart & "dfj" & ".pdf"
End If
End If
With ie
..Visible = True
..Navigate2 strFiletoFind
end with
end sub