Good morning,
I am working through a list on an excel spreadsheet that holds the variables needed to access records on website. I am able to get to a page where a javascript popup causes me some issues.. I am trying to get some help with my code to "click" on the link and have the pop up displayed. My code does not give any errors, but when I step through the code, the page simply refreshes when the operable line is ran... my code is as follows:
Sub BackshopMacro()
Dim IE As Object
Dim ControlID As String
Dim ImpliedCapRate As String
Dim NoteID As String
Dim PropertyID As String
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://backshop.fairviewres.com/Locator/LoanLocator.aspx" 'load the Backshop Loan Locator page
Do
DoEvents
Loop Until IE.ReadyState = 4
IE.document.All("Login1$Login1$UserName").Value = "XXXX"
IE.document.All("Login1$Login1$Password").Value = "YYYY"
IE.document.All("Login1$Login1$LoginButton").Click
Do
DoEvents
Loop Until IE.ReadyState = 4
'Application.Wait (Now + TimeValue("0:00:03"))
'This is where we start the Loop
Sheets("Sheet1").Select
Range("A2").Select
Do Until ActiveCell.Value = ""
ControlID = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ImpliedCapRate = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
NoteID = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
PropertyID = ActiveCell.Value
IE.Navigate "http://backshop.fairviewres.com/Locator/LoanLocator.aspx"
IE.document.All("ctl00$cph$LoanLocatorSearch1$ControlID").Value = ControlID
Dim Doc As HTMLDocument
Set Doc = IE.document
Do
DoEvents
Loop Until IE.ReadyState = ReadyState_Complete
'Application.Wait (Now + TimeValue("0:00:03"))
IE.document.All("ctl00$cph$LoanLocatorSearch1$btnSearch").Click
Do
DoEvents
Loop Until IE.ReadyState = 4
While IE.Busy
DoEvents
Wend
'Application.Wait (Now + TimeValue("0:00:03"))
IE.document.getElementbyID("ctl00_cph_LoanLocatorSearch1_SearchResults1_GridViewResults_ctl02_lnkDealName").Click
Application.Wait (Now + TimeValue("0:00:03"))
IE.Navigate "http://backshop.fairviewres.com/Property/Property.aspx?controlid=" & ControlID & "¬eid=" & NoteID & "&propertyid=" & PropertyID
IE.Navigate "http://backshop.fairviewres.com/Underwriting/UnderwrittenCFHeader.aspx?controlid=" & ControlID & "&propertyid=" & PropertyID & "¬eid=" & NoteID & "&action=propchange&underwrittencfheaderid=0&ucfuaname="
'IE.document.All("ctl00$cph$CapRate$NB").Value = ImpliedCapRate
'IE.document.All("ctl00$cph$UpdateAddNewDelete2$UpdateButton").Click
IE.document.parentWindow.execScript "__doPostBack('ctl00$cph$btnShowPopup','');"
Application.Wait (Now + TimeValue("0:00:03"))
Call IE.document.parentWindow.execScript("__doPostBack('ctl00$cph$btnShowPopup','')", "JavaScript")
'IE.document.getElementbyID("__doPostBack('ctl00$cph$btnShowPopup',''").Click
Sheets("Sheet1").Select
ActiveCell.Offset(1, -3).Select
Loop
End Sub
The html looks like this:
a id="ctl00_cph_btnShowPopup" href="javascript:__doPostBack('ctl00$cph$btnShowPopup','')">> Assign/Change Operating Statements</a
Any assistance that can be provided would be greatly appreciated!
I am working through a list on an excel spreadsheet that holds the variables needed to access records on website. I am able to get to a page where a javascript popup causes me some issues.. I am trying to get some help with my code to "click" on the link and have the pop up displayed. My code does not give any errors, but when I step through the code, the page simply refreshes when the operable line is ran... my code is as follows:
Sub BackshopMacro()
Dim IE As Object
Dim ControlID As String
Dim ImpliedCapRate As String
Dim NoteID As String
Dim PropertyID As String
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://backshop.fairviewres.com/Locator/LoanLocator.aspx" 'load the Backshop Loan Locator page
Do
DoEvents
Loop Until IE.ReadyState = 4
IE.document.All("Login1$Login1$UserName").Value = "XXXX"
IE.document.All("Login1$Login1$Password").Value = "YYYY"
IE.document.All("Login1$Login1$LoginButton").Click
Do
DoEvents
Loop Until IE.ReadyState = 4
'Application.Wait (Now + TimeValue("0:00:03"))
'This is where we start the Loop
Sheets("Sheet1").Select
Range("A2").Select
Do Until ActiveCell.Value = ""
ControlID = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ImpliedCapRate = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
NoteID = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
PropertyID = ActiveCell.Value
IE.Navigate "http://backshop.fairviewres.com/Locator/LoanLocator.aspx"
IE.document.All("ctl00$cph$LoanLocatorSearch1$ControlID").Value = ControlID
Dim Doc As HTMLDocument
Set Doc = IE.document
Do
DoEvents
Loop Until IE.ReadyState = ReadyState_Complete
'Application.Wait (Now + TimeValue("0:00:03"))
IE.document.All("ctl00$cph$LoanLocatorSearch1$btnSearch").Click
Do
DoEvents
Loop Until IE.ReadyState = 4
While IE.Busy
DoEvents
Wend
'Application.Wait (Now + TimeValue("0:00:03"))
IE.document.getElementbyID("ctl00_cph_LoanLocatorSearch1_SearchResults1_GridViewResults_ctl02_lnkDealName").Click
Application.Wait (Now + TimeValue("0:00:03"))
IE.Navigate "http://backshop.fairviewres.com/Property/Property.aspx?controlid=" & ControlID & "¬eid=" & NoteID & "&propertyid=" & PropertyID
IE.Navigate "http://backshop.fairviewres.com/Underwriting/UnderwrittenCFHeader.aspx?controlid=" & ControlID & "&propertyid=" & PropertyID & "¬eid=" & NoteID & "&action=propchange&underwrittencfheaderid=0&ucfuaname="
'IE.document.All("ctl00$cph$CapRate$NB").Value = ImpliedCapRate
'IE.document.All("ctl00$cph$UpdateAddNewDelete2$UpdateButton").Click
IE.document.parentWindow.execScript "__doPostBack('ctl00$cph$btnShowPopup','');"
Application.Wait (Now + TimeValue("0:00:03"))
Call IE.document.parentWindow.execScript("__doPostBack('ctl00$cph$btnShowPopup','')", "JavaScript")
'IE.document.getElementbyID("__doPostBack('ctl00$cph$btnShowPopup',''").Click
Sheets("Sheet1").Select
ActiveCell.Offset(1, -3).Select
Loop
End Sub
The html looks like this:
a id="ctl00_cph_btnShowPopup" href="javascript:__doPostBack('ctl00$cph$btnShowPopup','')">> Assign/Change Operating Statements</a
Any assistance that can be provided would be greatly appreciated!