VBA Help

OHtoMSP

New Member
Joined
Aug 26, 2011
Messages
7
Hi-

So I'm using VBA to complete a form in Internet Explorer. Within the form, I enter text in one box(Store Number), then text in another(Qty per Store), then I click a button.

The problem is the image is clicked before the text is entered, so I get an error telling me to enter a "Store Number." How can I get it to wait for the text to enter? Something like waiting for text playback in MacroExpress.

Code:
Set storeID = appIE.Document.getElementsByName("StoreNumber")
storeID(0).Value = Cells(y, 4)
Set Push = appIE.Document.getElementsByName("QtyPerStore")
Push(0).Value = Cells(y, 5)
Set IMG = appIE.Document.getElementsByTagName("IMG")
For Each IMGx In IMG
    If IMGx.alt = "Add Store(s) to Selection(s)" Then
    IMGx.Click
    End If
Next
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hello OHtoMSP,

Try using the Text property of the cell when assigning the cell's value to the Input Text. This will make sure the value is always text.
Rich (BB code):
Set storeID = appIE.Document.getElementsByName("StoreNumber")
storeID(0).Value = Cells(y, 4).Text
Set Push = appIE.Document.getElementsByName("QtyPerStore")
Push(0).Value = Cells(y, 5).Text
Set IMG = appIE.Document.getElementsByTagName("IMG")
For Each IMGx In IMG
    If IMGx.alt = "Add Store(s) to Selection(s)" Then
    IMGx.Click
    End If
Next
 

OHtoMSP

New Member
Joined
Aug 26, 2011
Messages
7
Thanks, but I don't think I understood/explained it clearly.

When I enter the Store Number, it selects a store on a list that appears below. The HTML of which is below. I'm thinking it enters the text value and doesn't have time to lookup the store on the list before it submits.

HTML:
<B>Store Number Entry</B> <INPUT type="text" tabindex="1" name="storeNumber" size="5" maxlength="4" onKeyPress="enterNumeric();LocCheckForEnter()"
onBlur="LeadZeroStore()" onKeyup="AutoStoreSelect()"> <BR>
                                                              <BR>
                                                                 <SELECT tabindex="3" name="StoreSelectionList"
size="10" style="width: 190px" multiple>
                                                                      <OPTION
                                                                             value="0100">
                                                                      0100 - RIDGEDALE                         
                                                                      </OPTION>
                                                                     
                                                                      <OPTION
                                                                             value="0530">
                                                                      0530 - OMAHA NW                           
                                                                      </OPTION>

It then goes on to list several options.
 

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hello OHtoMSP,

It would help me to see the web page. Can you post or send me the URL?
 

OHtoMSP

New Member
Joined
Aug 26, 2011
Messages
7
I can't send a link since it isn't a public website. Would it be possible to execute onkeypress="EnterNumeric();LocCheckForEnter()" or the OnKeyUp="AutoStoreSelect"? I'm thinking one of these would execute the lookup function.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,129
Messages
5,599,903
Members
414,345
Latest member
Jonathan43

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
Top