VBA to enter Excel text into webpage iframe

yuyyp445

New Member
Joined
Aug 4, 2017
Messages
6
Currently VBA logs me in and navigates to webpage with entry fields. (first of all, maybe I am not using right src to call on elements, since there are iframes. IDK) Then I need to enter text (numbers and letters) into different entry fields. So basically need to automate info from Excel cell to webpage entry fields, rather than have a user manually type in info. Below is source code of iframe and element I need to enter information into.

...this is the iframe:

HTML:
******** width="100%" height="100%" src="/GC3/glog.webserver.util.BodyServlet/nss?ct=508213585" scrolling="auto" frameborder="0" id="mainBody" name="mainBody"> *********>

.....then there are a bunch of divs and tbody... then the textbox I need to enter information into is "ob_line/attribute19". See below:

HTML:
<div class="fieldCont">
  <div class="gridHeadLabel">Trailer#</div><input type="hidden" name="default_grid_value_ob_line/attribute19" value="">
  ********>
    new GridField('management_main', 'ob_line/attribute19', 'Trailer#', 'ob_line_grid', 'fieldText');
  *********><input type="hidden" name="fieldName_ob_line_grid" value="ob_line/attribute19"><input type="hidden" name="fieldType_ob_line_grid" value="fieldText"><input type="text" name="ob_line/attribute19" nowrap="true" size="18" value="" maxlength="101"
    onchange="this.value=this.value.toLocaleUpperCase();" onblur="this.value=this.value.toLocaleUpperCase();" onfocus="return false;">
  ********>
    new StringField('management_main', 'ob_line/attribute19', 'Trailer#', 101, 'ob_line_grid', 'false', 'false', '');
  *********>
</div>

... here is my with statement. Notice how the website I am navigating to does not match src of iframe. IDK if this matters. https below opens proper window; I just want to make it known it is different in case that matters

Code:
[/FONT][/COLOR]With ie
    .Visible = True
    .navigate "https://xxxxxx.com/GC3/RapidOBCustManagementServlet?ct=1685071083&manager_layout_gid=NAM.RA_US_PPS_REQ&new=y", CLng(2048)
 
DoEvents
Loop Until ie.readyState = 4
Pause (5)
Set HTMLsrc = .document
HTMLsrc.frames("mainBody").document

.... I know this with statement is pretty much nothing, but it sends back [object] when I execute this in Immediate VBA window. This is the best I have. Everything else has just been errors... I just need help in how I step through this iframe and then enter info for element, ob_line/attribute19... After we step through iframe, do I just have to do ie.document.getElementByID("ob_line/attribute19".Value = ThisWorkbook.Sheets("Sheet1").Range("whatever cell i want").Value2
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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