Avatar of rrhandle8
rrhandle8
Flag for United States of America asked on

VBA to fill-in web form

We buy a lot of items at Sam's Club.  I wrote an Excel VBA program to keep track of the inventory, and to automate the purchase of items. A couple of days ago they change something on the site.  Looks the same, but the coding is different.  If you look at the front page, you'll see a search box and a magnifying glass next to it that works as a search button.  It is the search button we cannot click programmatically.  Any ideas?
And before someone asks, no, Sam's Club does not have an API for placing orders, and they say they have no intentions of creating one.
Microsoft Excel

Avatar of undefined
Last Comment
aikimark

8/22/2022 - Mon
aikimark

please post the code that you currently use
rrhandle8

ASKER
Code is attached.

I got it to work by adding the two lines that start with "-->"
SamsClub-sample.txt
aikimark

What data is in column A of your Items worksheet?  Just want to see one or two examples.

I think your code is overly complicated because you're using IE
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
rrhandle8

ASKER
Suggestions to using IE?
aikimark

please give me some examples of what is in column A of your worksheet.
It looks like you're just putting the URL if the search succeeds.  Am I reading this wrong?
rrhandle8

ASKER
Item#
13433230
14484656
15574090
15667515
15870476
15905012
16130065
80005208
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
rrhandle8

ASKER
aikimark,

I got it to work with the following changes on these lines. I think it was the extra pause that did the trick.
So, what is a faster way to do this than using IE?

        ie.Document.getElementById("searchBar").Focus    'get the focus point of the input box
        Func.PauseBrowser
        SendKeys "~"    'do search
        Func.PauseBrowser

Open in new window

aikimark

I manually searched for those items and nothing was returned.
rrhandle8

ASKER
Old items.  I didn't know we were going to do a search on them.  Here are some active ones.

34488
196449
242249
341375
571453
651234
747192
995786
999999
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
aikimark

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question