Solved

VBA to fill-in web form

Posted on 2014-11-08
10
129 Views
Last Modified: 2014-11-22
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.
0
Comment
Question by:rrhandle8
  • 5
  • 5
10 Comments
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
please post the code that you currently use
0
 

Author Comment

by:rrhandle8
Comment Utility
Code is attached.

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

Expert Comment

by:aikimark
Comment Utility
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
0
 

Author Comment

by:rrhandle8
Comment Utility
Suggestions to using IE?
0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
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?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:rrhandle8
Comment Utility
Item#
13433230
14484656
15574090
15667515
15870476
15905012
16130065
80005208
0
 

Author Comment

by:rrhandle8
Comment Utility
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

0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
I manually searched for those items and nothing was returned.
0
 

Author Comment

by:rrhandle8
Comment Utility
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
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
Comment Utility
This is an interesting problem.  The codes you are searching are a mix of Sam's specific and general (Walmart) values.  If your worksheet contained the Sam's values, the MSXML2 object is the desired solution.  It has less overhead and is faster than the IE automation solution.  Unfortunately, I haven't been able to find a good combination of URI keywords that will yield reliable results for non-Sam's values.  The best thing to do would be to accept your own comment, http:#a40448969 , as the solution.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now