Morning everyone!!
I have inherited the following code and its started failing on the line thats highlighted by stars below in the code...
Can anyone tell why by any chance, or what that line is attempting to do??...???
Cheers
Mikey
I have inherited the following code and its started failing on the line thats highlighted by stars below in the code...
Can anyone tell why by any chance, or what that line is attempting to do??...???
Code:
Global IE
Global CS
Sub LOGIN()
Dim X As String
X = Sheets("Back Sheet").Range("L20")
Calculate
If X = "X" Then
MsgBox "ERROR time must be at least 10 mins in the future"
Exit Sub
Else
End If
number = Sheets("Back Sheet").Range("L20")
listname = Sheets("Front Sheet").Range("B20")
Filename = Sheets("Front Sheet").Range("B19")
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "https://62.232.19.24/MEnable/Client/servlets/Login?b=2057"
IE.Visible = True
IE.Top = 0
IE.Left = 0
IE.Height = 0
IE.Width = 0
Call WS
IE.Document.all("ClientOnly").Value = "Funding Corporation"
IE.Document.all("AccountOnly").Value = "Sbaldwin"
IE.Document.all("Password").Value = "Skyline12"
CS = "Logging into Server"
Call stat
Call WS
PRE = IE.locationURL
SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{enter}", 1
CS = "Login Sucessful"
Call stat
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(3).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(11).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
CS = "Creating List Name"
Call stat
SendKeys "{tab}"
IE.Document.all("Name").Value = listname
IE.Document.all("Name").Select
SendKeys "{tab}{enter}"
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
CS = "List Created"
Call stat
IE.Navigate IE.Document.links(3).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(15).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
Sheets("Back Sheet").Range("B24") = IE.Document.Body.OuterHtml
CS = "Importing Texting List"
Call stat
IE.Document.all("ImportToList").Value = Sheets("Back Sheet").Range("C23").Value
IE.Document.all("upload").Select
SendKeys Filename
SendKeys "{tab} {tab} {tab} {tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}"
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
Sheets("Back Sheet").Range("B24") = IE.Document.Body.innerText
CS = Format(Sheets("Back Sheet").Range("D23"), "0") & " Users Added: " & Format(Sheets("Back Sheet").Range("E23"), "0") & " Users Updated: " & Format(Sheets("Back Sheet").Range("F23"), "0") & " Users Discarded: " & Format(Sheets("Back Sheet").Range("G23"), "0")
hold = CS
Call stat
IE.Navigate IE.Document.links(6).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(11).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(19).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Document.all("ConfirmOptIn").Checked = True
SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}"
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Navigate IE.Document.links(11).href
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
IE.Document.all("ExistingList").Value = listname
SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}"
Call WS
While PRE = IE.locationURL
Call WS
Wend
PRE = IE.locationURL
CS = "Inputting Send condidtions"
Call stat
IE.Document.all("DateDay").Value = Sheets("Back Sheet").Range("I19")
IE.Document.all("DateMonth").Value = Sheets("Back Sheet").Range("I20")
IE.Document.all("DateYear").Value = Sheets("Back Sheet").Range("I21")
IE.Document.all("DateHour").Value = Sheets("Back Sheet").Range("J18")
IE.Document.all("DateMinute").Value = Sheets("Back Sheet").Range("K18")
IE.Document.all("Text").Value = "{MM}"
IE.Document.all("ServiceLevel").Value = 334
IE.Document.all("Validity").Value = 60
While IE.busy
DoEvents
Wend
SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}"
Call WS
Sheets("Back Sheet").Range("B24") = IE.Document.Body.innerText
While Sheets("Back Sheet").Range("H23") = "ON"
Sheets("Back Sheet").Range("B24") = IE.Document.Body.innerText
Call WS
Wend
***IE.Document.all("Name").Value = listname********************
PRE = IE.Document.Body.innerText
SendKeys "{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}"
While PRE = IE.Document.Body.innerText
Call WS
Wend
Sheets("Back Sheet").Range("B24") = IE.Document.Body.innerText
CS = Sheets("Back Sheet").Range("I23")
Call stat
IE.Visible = False
Set IE = Nothing
Windows("MobileMarketer Front End PR.xls").Activate
MsgBox "Send Summary:" & vbCrLf & vbCrLf & hold & vbCrLf & vbCrLf & CS & vbCrLf & vbCrLf & "Programmed Issue Point " & Sheets("Back Sheet").Range("I18") & " at " & Sheets("Back Sheet").Range("L18")
Sheets("Front Sheet").Range("B22") = "Idle"
Windows("MobileMarketer Front End PR.xls").Activate
If CS = "Error In Final import stage" Then
MsgBox "There has been an error in importing the list." & vbCrLf & "If necissary repeat the import cycle from the start" _
& vbCrLf & "There are a number of possible reasons:" _
& vbCrLf & "1. You have already sent a batch on the current import (so re Import the list, conditions can remain the same" _
& vbCrLf & "2. You have attempted to send the texts while using other programs on your desk top, (Retry but Don't touch the computer" _
& vbCrLf & "3. Any internet connectivity problems will affect this service so if the internet is slow keep trying or try later"
Else
End If
EX:
Exit Sub
errorback:
MsgBox "There has been an error in importing the list." & vbCrLf & "If necissary repeat the import cycle from the start" _
& vbCrLf & "There are a number of possible reasons:" _
& vbCrLf & "1. You have already sent a batch on the current import (so re Import the list, conditions can remain the same" _
& vbCrLf & "2. You have attempted to send the texts while using other programs on your desk top, (Retry but Don't touch the computer" _
& vbCrLf & "3. Any internet connectivity problems will affect this service so if the internet is slow keep trying or try later"
IE.Visible = False
Set IE = Nothing
Resume EX:
End Sub
Cheers
Mikey