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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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
 
Upvote 0
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.
 
Upvote 0
Hello OHtoMSP,

It would help me to see the web page. Can you post or send me the URL?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

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