Enter value into a specific cell on a popup - vba

ddotson

Board Regular
Joined
Nov 9, 2004
Messages
57
Hello,

I continue to work on a large project for my Company, and have once again ran into a wall...

I am attempting to enter information into a cell on a webpage (might be a form?) that has the following attributes:

input name="ctl00$cph$MultiplyByAbsolute$NB" type="text" value="100.00" maxlength="7" id="ctl00_cph_MultiplyByAbsolute_NB" class="editableInputText55" maxvalue="999" decimalplaces="2" pr="" currencysymbol="" thousandssymbol="," decimalsymbol="."

I have tried the following without success:

IE.document.getElementByname("ctl00$cph$MultiplyByAbsolute$NB").setAttribute "value", "103"

IE.document.getElementByname("ctl00$cph$MultiplyByAbsolute$NB").value= 103

HTMLDoc2.forms("ctl00$cph$MultiplyByAbsolute$NB").TEXTFIELDNAME.Value = 103


Anyone have any ideas on the line I need to use to make this work?

Any help would be greatly appreciated!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I have also tried E.document.getElementById("ctl00_cph_MultiplyByAbsolute_NB").Value = "103", but received a Run Time Error 424 - Object required. Full code 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



'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"

Do
DoEvents
Loop Until IE.ReadyState = 4

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




IE.document.all("ctl00$cph$LoanLocatorSearch1$btnSearch").Click



Do
DoEvents
Loop Until IE.ReadyState = 4



IE.document.getElementById("ctl00_cph_LoanLocatorSearch1_SearchResults1_GridViewResults_ctl02_lnkDealName").Click

Do
DoEvents
Loop Until IE.ReadyState = 4


IE.Navigate "http://backshop.fairviewres.com/Property/Property.aspx?controlid=" & ControlID & "&noteid=" & NoteID & "&propertyid=" & PropertyID

Do
DoEvents
Loop Until IE.ReadyState = 4

IE.Navigate "http://backshop.fairviewres.com/Underwriting/UnderwrittenCFHeader.aspx?controlid=" & ControlID & "&propertyid=" & PropertyID & "&noteid=" & NoteID & "&action=propchange&underwrittencfheaderid=0&ucfuaname="

Do
DoEvents
Loop Until IE.ReadyState = 4


IE.document.getElementById("ctl00_cph_HLAC_ISR").Click


Above here works - this is the problem area.. I am not sure what Object it is expecting me to declare?? From here, a pop up window appears - perhaps I need to declare a new document??

'The below code is not correct - each provides an error - Object Required


IE.document.getElementById("ctl00_cph_MultiplyByAbsolute_NB").Value = "103"



'IE.document.getElementbyName("ctl00$cph$MultiplyByAbsolute$NB").Attribute "value", "103"




'Below here works
'The below is the popup for Assigning Operating Statements
'IE.document.getElementById("ctl00_cph_btnShowPopup").Click




'The below works to be able to click the number 10 on the list
'IE.document.all("ctl00$cph$GridViewOpStatements$ctl11$Selected").Click




'The below works to save the clicks to the pop up
'IE.document.all("ctl00$cph$UpdateAddNewDelete2$UpdateButton").Click


Sheets("Sheet1").Select
ActiveCell.Offset(1, -3).Select

Loop

MsgBox "Done, *****"

End Sub
 
Upvote 0
I have figured out, by placing in the URL for which I am currently missing a variable, that my issue is that I have not declared the pop up as a new object, therefore cannot control the attributes, or anything for that matter, until this happens. I have a SQL query to my warehouse that gives me all the variables, except one, else I could drive the URL...

So, in the end of the day, if someone can look at my code and let me know how I could create an object for the pop-up window, I am on my way. Thanks for the help!!
 
Upvote 0
Done, found variable that allowed me to bypass the new object issue. IE.document.getElementById("ctl00_cph_MultiplyByAbsolute_NB").Value = "103" works flawlessly when I go directly to the page.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top