Copy Web Page Data
By Richard Rost
2 months ago
Copy Web Data From Sites Like Amazon & Walmart
In this video, I will show you how to copy web page data that you can see on the screen and bring it into Microsoft Access, even when background methods like APIs, HTTP requests, or browser controls do not work. We will discuss why standard techniques often fail on sites like Amazon and Walmart, and I will walk you through a practical VBA solution that uses FollowHyperlink, AppActivate, Sleep, and SendKeys to automate copying text from your browser to your Access database. This technique is ideal when you need a simple way to capture prices and other information for tracking and comparison.
Corinne from Tempe, Arizona (a Platinum Member) asks: How can I compare prices from Walmart and Amazon every week and save them in Access when I can't get the prices to show up? I keep a small Access database for my household stuff. I usually bounce back and forth between Walmart and Amazon for things like coffee, olive oil, and paper towels, and I'm tired of flipping between browser tabs and trying to remember which one was cheaper last time. I tried following one of your videos where you pull data from a website directly, and I can get the product names just fine, but the prices never come through. The weird part is I can see the prices on the screen, but Access acts like they don't exist. I don't need anything fancy or real-time updates, I just want to grab what I'm looking at and save it so I can compare prices later without all the back and forth every week.
Members
There is no extended cut, but here is the file download:
Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!
Prerequisites
Links
Recommended Courses
Up Next
Keywords
TechHelp Access, Amazon, Walmart, FollowHyperlink, AppActivate, SendKeys, VBA, clipboard automation, web scraping workaround, screen scraping, price comparison, browser automation, TechHelp Free Template, Sleep function, RunCommand Paste, Edge browser control, background web requests, API limitations
Intro In this video, I will show you how to copy web page data that you can see on the screen and bring it into Microsoft Access, even when background methods like APIs, HTTP requests, or browser controls do not work. We will discuss why standard techniques often fail on sites like Amazon and Walmart, and I will walk you through a practical VBA solution that uses FollowHyperlink, AppActivate, Sleep, and SendKeys to automate copying text from your browser to your Access database. This technique is ideal when you need a simple way to capture prices and other information for tracking and comparison.Transcript Today I'm going to show you how to get data from sites like Amazon, Walmart, your bank, your credit card company; basically, anything you can see on the screen we can bring into Microsoft Access.
Even if you've already tried using a web API, an HTTP background request, the Edge browser control, and the data still will not show up, I'm going to walk you through a simple, practical solution that just works.
We'll talk about why those background methods fail and how to get around the problem without overcomplicating things.
Today's question comes from Corinne in Tempe, Arizona, one of my Platinum members. Corinne says,
"How can I compare prices from Walmart and Amazon every week and save them in Access when I can't get the prices to show up? I keep a small Access database for my household stuff. Usually, I bounce back and forth between Walmart and Amazon for things like coffee, olive oil, and paper towels. I'm tired of flipping between browser tabs and trying to remember which one was cheaper last time. I tried following one of your videos where you pull data from a website directly and I can get the product names just fine, but the prices never come through. The weird part is I can see the prices on the screen, but Access acts like they don't exist. I don't need anything fancy or real-time updates; I just want to grab what I'm looking at and save it so I can compare prices later without all the back and forth every week."
This is a great idea, Corinne. I have been thinking about building a database like this myself because I have certain things I buy every week. I do most of my shopping either through Amazon or Walmart, like Whole Foods delivery or Walmart delivery. If you pay for their membership, you get free delivery, and I really hate going to the grocery store, so it saves me a ton of time.
It would not be that difficult to simply keep a database where you've got the product and the price from each, and then every week when it's time to go grocery shopping, you just click a button and have Access go get the prices from those websites and pull them in. Then you can compare who's going to be cheaper. Great idea.
The problem is they don't want you doing that. Now, for a lot of websites, you can read in data using an API (Application Programming Interface). That's the site's official way of letting programs ask for data directly. When it exists, that's always the best place to start. A lot of pages have APIs. I have covered some of them in the past and you just send a little request out and it gives your data back.
Now, Amazon and Walmart do have APIs, but you have to be set up as a seller and there's a lot ahead in getting access to that. For the average consumer who just wants to check the price of bananas and toilet paper, that's overkill.
If there is no API or if it doesn't give you what you need, you can try reading the page and you could try a background read using MSXML HTTP requests, which I have shown you before, or even using the Edge browser control, which again I have shown you before. I'm going to give you links to all these videos in just a minute.
However, the problem is sites like Amazon and Walmart don't put the pricing directly in the page HTML anymore. They intentionally obfuscate it and inject it later with something like JavaScript. So when you read the page behind the scenes, the prices are not there. There are little placeholders for them.
Try it: use the HTTP request like I showed you before, read in a page from Amazon. You won't find the pricing anywhere on there. You'll find little placeholders, because after the page loads in your browser, a JavaScript function kicks in and then feeds the price in there. An Access HTTP call won't get it.
For some other sites like banking, credit cards, and medical sites, you've actually got to be logged in before you can see anything at all, which makes background methods basically useless.
So when all that fails, the only reliable option left is to copy what you actually see on the screen and bring that back to Access. I like to call this Rick's good enough solution. It's not perfect. It's not fancy. But it works, and sometimes that's all you need is just something that works. It doesn't have to be perfect.
So what are we going to do?
First, we are going to load the web page using FollowHyperlink. Again, I have videos for all this stuff already. I'm going to give you links in just a minute. That is going to open up the page in your browser just like you clicked on the link yourself.
We're going to give it a second to load with a little Sleep command. Then we're going to switch to the browser using AppActivate. Again, we've covered that before. We're basically tapping Windows on the shoulder and saying, "Hey, go look over there. That application I just opened."
Then we're going to use SendKeys to copy the text. That's the same thing you do with your hands on the keyboard: Ctrl+A to select all the text, Ctrl+C to copy it. We're just pretending that we're a fast little robot with a keyboard.
And yes, as I have said in my SendKeys video, I don't like relying on SendKeys, but sometimes it's good enough to get the job done. This is one of those cases, especially when you're working with applications outside of Access.
After that, we switch back to the database, set the focus where we want it to go like in a text box, paste it, and that's it. No APIs, no parsing, no arguing with JavaScript. You just copy what you see and stick it into Access.
Is it elegant? No. Is it reliable? Mostly. Does it get the job done? Yep.
And like the Terminator would say, "No problemo."
Let's take a look at some prerequisites of what we're going to need.
Obviously, this is going to be a developer-level video. If you've never done any VBA before, go watch this. It'll get you started.
We're going to use FollowHyperlink to launch the web page. We're going to use the Sleep function because you need a little pauser. You have to wait for the website to load, and different sites might load differently: three seconds, five seconds, it depends. So go watch this video.
We'll need AppActivate to switch to the other window (to the browser) once it opens.
My favorite function: SendKeys. It's the good enough sometimes function. Well, that's the king of the good enough sometimes functions. It works most of the time. Go watch this video. This shows you how to copy to the clipboard (copy and paste). We have to use SendKeys Ctrl+C to copy in the web browser. But once we get back to Access, we can use RunCommand Paste or you can use Ctrl+V, whichever you want. This shows you how to use the clipboard.
While we're going over videos, using a web API is something that I have covered before. This is where you can talk to a website in the background without actually having to load the browser. This video, for example, shows you how to get the current date and time. But there are lots of websites with APIs. This is the code that you need, though, to try to do that. But this is also the data that sites like Amazon and Walmart hide because they don't want you doing that. If you're curious about this, go watch this video.
This video, part eight of my Edge browser control series, shows you how to actually get page text. But again, it's hidden if you try one of these other sites.
These are all free videos. They're on my website. They're on my YouTube channel. Go watch any of those that you feel you need to and then come on back.
Here I am in my TechHelp free template. This is a free database. You can grab a copy off my website if you want to.
Let's start off with a simple example. Let's just grab the stuff on the homepage of my website.
We're going to go into here, Design View. We got a nice box. Super. We can use Status Box to drop the stuff and we got a Hello World button. We'll just use all this stuff.
Right click, Build Event.
Now this is going to be more about me showing you how to put together the pieces of stuff we've learned in other videos. If you haven't watched all those other videos, you're not going to know what we're doing.
First thing we have to do is open up my website. So,
FollowHyperlink "https://599CD.com"
Why 599CD? It's a long story. It's on my website. I'll put a link down below if you're curious.
Now we want to give the website time to load. You might want to just count and see how long it takes to load. I like to give it a little bit longer than needed. Come back out here. Let's just open it up and click the button.
Okay, loaded pretty fast. I'm going to say let's wait a second. Oh, there's the page I just showed you.
After that we're going to Sleep 1000. Remember those are milliseconds.
Now, AppActivate needs to know what the title of the window is. Did you catch what that was? Let's go back in here. Let's load it up again.
For my website, it's "Computer Learning Zone." That's important. It doesn't matter what the URL is. It wants to find the title of the window, which is the browser tab title.
So now we're going to use AppActivate.
AppActivate "Computer Learning Zone"
It doesn't have to be exact, but it has to be close enough. We're going to see a problem with this later on too.
Again, give it a brief pause here. You don't have to wait as long. Maybe Sleep 500. Half a second should do it. If any of these steps crap out on you, give it a longer pause.
Now we've AppActivated my website. So now the focus should be sitting on that window.
Now we're going to Ctrl+A to select all the text. So,
SendKeys "^a"
Make sure you use a little caret symbol there for Ctrl. I think plus is Shift and then something else is Alt. I cover that in the SendKeys video. Make sure you use a lowercase "a." Otherwise, it's going to send Ctrl+Shift+A, which you don't want.
Give it a little pause. Sleep 500.
Now that you've got all the text highlighted, we can copy it.
SendKeys "^c"
This is Copy Text.
Copy, add, copy.
Okay, again, give it a pause.
See, my fingers are just so used to typing 599 because my website's 599. Always, whatever, type 5 always goes to 9.
We've copied it to the clipboard. Now we've got to switch back to the database. The title of my database is "TechHelp Free Template." Whatever the title of your database is, now you want to use that.
AppActivate "TechHelp Free Template"
Now we should be back in Access.
Set focus where you want it to go. Now, the form that you click on should be in the foreground. I'm going to set focus on this thing here, which is the Status Box.
StatusBox.SetFocus
If you think you need to give it another little pause here, do it. You shouldn't have to once you're back in Access, but just to be safe, it can't hurt.
Now you can SendKeys Ctrl+V to paste it, or you can use DoCmd.RunCommand acCmdPaste. That's a built-in command that you can use inside of Access.
Then we're all done.
We'll be.
Let's see if it works. Save it. Debug Compile once in a while. I'm going to close this. Are you ready?
Here we go.
Click, switch over, copied it, pasted it. Boom, there you go.
This is all the text on my website. Just the text right there.
And this will get around problems with Amazon. Let's try an Amazon page, and we'll do that in tomorrow's videos. Tune in tomorrow, same bat time, same bat channel. Members can watch it right now because I'm going to record it right now. That's one of the benefits of being a member: you can watch it right now.
Today you saw why getting data directly from websites doesn't always work, even when the data is clearly visible on the screen. We talked about APIs, background web requests, and browser-based methods, and sometimes they come up empty because those companies like playing little tricks. They don't want people doing what we're doing.
We're not doing anything illegal or wrong. They certainly don't want hackers scraping their entire site. But if you just want to use this to pull 10, 15, 20 pages to see what the price of your groceries are, they're not going to care about that. If they do, then that's their fault. But I will remind you: use this responsibly, folks.
Today we learned a practical workaround by grabbing the data you can actually see on the screen and bringing it into Access using real, working data from my own website. I don't mind if you do a little scraping. If I see someone doing hundreds of pages a minute, then I ban their IP address, but that's a different story.
Tomorrow, in part two, we're going to take the same approach. We're going to try it on a real site like Amazon, where things get a little more interesting. You'll see what works, what doesn't, what you have to watch out for, and we'll talk about more stuff like that.
If this video helped you out, post a comment down below. Let me know what you thought and how you might use this technique in your own databases. I always like reading your comments.
That's going to do it for your TechHelp video for today. Brought to you by AccessLearningZone.com.
I hope you learned something. Live long and prosper, my friends.
I'll see you tomorrow for part two.Quiz Q1. Why do background methods like APIs or HTTP requests often fail to retrieve prices from sites like Amazon and Walmart? A. Because the prices are injected into the page using JavaScript after the initial HTML loads B. Because those sites block all internet access from Access C. Because Access cannot read product names at all D. Because the prices are stored on a different server
Q2. What is usually the best method to access data from a website if it is available? A. Using the website's official API B. Using SendKeys to copy the screen C. Manually typing prices into Access D. Taking screenshots and using OCR
Q3. When there is no usable API or HTML data is hidden, what practical method does the video recommend for getting information? A. Copying what you see on the screen and pasting it into Access B. Trying more aggressive HTTP requests until it works C. Running PowerShell scripts to analyze network traffic D. Using manual data entry forms only
Q4. What VBA command is recommended to open a web page in the user's browser from Access? A. FollowHyperlink B. ShellExecute C. LaunchBrowser D. OpenPage
Q5. Why is the Sleep command used in this process? A. To give the web page time to fully load before copying data B. To put the computer into sleep mode C. To speed up the script D. To make Access run faster
Q6. What does AppActivate do in the solution presented? A. Brings the specified window (like the browser or Access) to the foreground B. Shuts down all other applications C. Downloads the web page contents in the background D. Runs antivirus software
Q7. What is the role of SendKeys in the solution? A. To simulate keyboard shortcuts like Ctrl+A to select all and Ctrl+C to copy B. To generate random keys for encryption C. To automate mouse clicks D. To run background processes
Q8. What needs to be known about the browser window to use AppActivate successfully? A. The title of the browser tab or window B. The URL of the website C. The IP address of the website D. The browser version
Q9. After copying the webpage data to the clipboard, what must be done to paste it in Access? A. Activate the Access window, set focus to the desired control, then paste B. Restart Access C. Refresh the web browser D. Use a custom clipboard handler
Q10. Why might you need to adjust the timing pauses (Sleep durations) in your VBA automation code? A. Different websites or computers load at different speeds B. To make the code look more complex C. Longer waits confuse Access D. To avoid saving the wrong data
Q11. Why do websites like Amazon and Walmart intentionally hide or obfuscate their price data in HTML? A. To prevent automated scraping and unauthorized data collection B. To make their websites load faster C. For security against viruses D. So users cannot see the prices
Q12. What is a potential downside to the "copy what you see" approach described in the video? A. It may not be fully reliable and is not very elegant B. It requires server admin rights C. It works in the background without user intervention D. It guarantees perfect copy every time
Q13. What should you always remember when using this data collection technique on commercial websites? A. Use it responsibly and avoid overuse that could lead to being blocked B. Publicly announce your data collection C. Always run it as fast as possible D. Use it for hacking sites
Answers: 1-A; 2-A; 3-A; 4-A; 5-A; 6-A; 7-A; 8-A; 9-A; 10-A; 11-A; 12-A; 13-A
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.Summary Today's video from Access Learning Zone covers how to bring data from websites, such as Amazon, Walmart, your bank, or credit card company, directly into Microsoft Access. If it's something you can view on your screen, there is a method to get that data into Access, even if standard tools like web APIs, HTTP requests, or browser controls have failed to give you the results you want.
Many students have tried the typical background methods I have shown in previous videos, such as using a web API, HTTP background requests, or browser controls like Edge, only to find that pricing or specific information simply does not show up in Access. The reason is that many modern websites intentionally hide critical data, such as prices, from the raw HTML you might be able to access programmatically. Instead, this data gets injected into the page after it loads, through JavaScript or other client-side techniques, so it never appears in the background data you can pull.
One of my Platinum members asked how to easily compare prices from Walmart and Amazon on a weekly basis in Access. She keeps a database to track her household shopping, but moving back and forth between browser tabs is tedious. She tried my background data-gathering methods, but while product names came through, prices never did. If you've had similar trouble, you are not alone.
While sites like Amazon and Walmart technically have APIs, they're mostly designed for sellers and require significant setup and permissions. For an everyday shopper just looking to check prices for weekly groceries, this is far more complicated than necessary. So most regular users fall back to trying to directly read web pages with HTTP requests or inside browser controls, but with the same result: the prices you see on the screen just are not present in the source data.
This is not limited to shopping sites. Any site that requires you to be logged in, like banks or medical portals, makes background data collection nearly impossible for the typical Access user.
So, what is the answer when all the official and background methods fail? My practical approach, which I jokingly call Rick's "good enough" solution, is to simply grab the data you see on your screen and bring it into Access. It is not fancy, it is not elegant, but it works and often that is all you need.
Here's the basic process:
First, we use Access VBA's FollowHyperlink command, which opens the web page in your default browser. After a short pause (using the Sleep function) to allow the page to load, we switch focus to the browser window using AppActivate. Then, the SendKeys function simulates pressing Ctrl+A to select all text, followed by Ctrl+C to copy everything to the clipboard. Although I generally avoid SendKeys when possible due to reliability issues, in scenarios like this it is sometimes the only viable method.
Once the webpage content is copied, we switch back to the Access application window using AppActivate once more, set focus to the text box or area where we want the data to go, and then paste it, either with another simulated Ctrl+V or via Access's built-in RunCommand Paste. That's the whole routine: no need to deal with APIs, parsing, or JavaScript tricks. Just copy what you need and paste it into Access.
This solution is not perfect. The reliance on SendKeys and precise window titles means it may need some fine-tuning on different systems, and a pause might need to be adjusted depending on how long pages take to load. But for basic use, such as tracking a handful of prices or values you can see on your screen, it is reliable enough.
If you want to try this process, here are the key concepts you will need to be familiar with:
- Using VBA to open external websites with FollowHyperlink - Adding appropriate pauses using Sleep, so web pages have time to finish loading - Switching application focus with AppActivate, making sure to use the correct window titles - Automating text selection and copying with SendKeys, being careful about syntax for control keys - Pasting data into Access, either with another SendKeys command or RunCommand Paste, after regaining focus
I have covered all of these topics in previous, freely-available video tutorials. If you have not seen them or are new to VBA, review those basics first.
For most of today's video, I demonstrated the technique inside my TechHelp Free Template (which you can download from my website). The demonstration started by pulling text from my own homepage to show how all the pieces fit together. I set up a button in a sample form that uses the process outlined above: opening the site, copying its content, switching back to Access, and pasting the copied data into a text box. This is the same process you would follow for any website, though window titles and pause durations may differ.
This direct copy-and-paste method will also allow you to get around the typical roadblocks on sites like Amazon. Tomorrow's video, part two, will focus on doing this with a real Amazon page, so you can see where things may get tricky and how to deal with those issues.
In summary, today's video explained why getting data from websites into Access is often harder than it looks, especially for dynamically generated or login-protected data. We covered why the usual programming methods fail and how to get real, visible data into Access by copying exactly what you see on the screen. If you only need to track a small number of items or accounts, and you are not doing anything commercial or unethical, this method should serve your needs.
If you found this helpful or have ideas on adapting this for your own databases, feel free to share your thoughts in the comments. Your feedback is always welcome.
You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.Topic List Why background methods fail to retrieve dynamic web data Explaining limitations of APIs for consumer-level use Demonstrating FollowHyperlink to open a web page in Access VBA Using Sleep to pause VBA while web pages load Using AppActivate to switch Windows application focus Using SendKeys for keyboard automation in Access VBA Copying visible web page content to the clipboard with SendKeys Switching focus back to Access from the browser Pasting clipboard text into an Access form control Full VBA workflow for grabbing live browser data into Access Adapting window and form titles for AppActivate usage Importance and placement of pauses between automation steps Setting focus to specific text boxes in Access forms Using DoCmd.RunCommand acCmdPaste for clipboard pasting in AccessArticle If you have ever wanted to collect data you see on websites like Amazon, Walmart, your bank, or your credit card company and bring it into Microsoft Access, you may have discovered it is not as straightforward as it seems. Many people try to pull data directly from page HTML or use web APIs, only to find that some information—often the prices or personalized data—simply does not show up. Even though you can plainly see the data in your browser, Access or VBA seems unable to read it. Let me show you a practical approach that reliably brings what is on your screen into Access, without unnecessary complexity.
Let us begin by discussing why the traditional, background methods often fail. Some websites offer APIs—which are official ways for outside programs to request and retrieve site information. Using an API is usually best if it is available and provides the data you need. Most of the time, though, APIs are limited or restricted to business partners, like sellers on Amazon or Walmart. For a regular user just trying to check routine prices or transactions, APIs are rarely practical.
Your next step is often to try background web requests, like using MSXML2.XMLHTTP in VBA to pull in the HTML of a webpage behind the scenes. Sometimes you can also automate the Edge browser control in Access. But increasingly, companies hide important information from that plain HTML. For example, Amazon and Walmart often do not store prices or stock information directly in the source code. Instead, they use JavaScript to fill in that information *after* the page loads in your browser. As a result, when Access or VBA reads the page in the background, it gets only placeholders or blank spots—no price data, even though it is right in front of you on the live page.
The same goes for many secure sites: banks, credit card companies, health portals, and any website where you need to log in. Browser-based API calls or HTTP requests do not include your login session, so they see a generic or locked-out page, not your private data. All these tricks are meant to protect site data or steer you toward in-house tools, so your VBA code just comes up empty.
The workaround is elegantly simple: if you can see it, you can copy it. Instead of trying to fetch the data invisibly, use Access to automate what you would do manually: open the webpage, let it load, select everything on the page, copy it, and paste it back into your Access database. This approach may not be beautiful or elegant in a pure programming sense, but it is reliable and fast for routine needs like comparing weekly prices across a few products.
Here is how you can set this up in VBA for Access:
First, you use the FollowHyperlink command in VBA to open the webpage you want in your default browser. For example, to open my own site, you would write:
FollowHyperlink "https://599CD.com"
This launches the page as if you clicked the link yourself. Next, you need to give the site time to load. You can use the Sleep command in VBA to pause the code for a set amount of milliseconds; Sleep 1000 waits for one second. Depending on your internet speed and the site, you may want to adjust the timing.
After the delay, use AppActivate in VBA to bring the browser window to the foreground. AppActivate looks for the browser window by its title, which is the text that appears in the tab for the page. For instance, if you open my website, the title might be "Computer Learning Zone," so you would use:
AppActivate "Computer Learning Zone"
Remember that the window title is what matters for AppActivate, not the URL. If you are using a different webpage, check what title appears in your browser tab when you load it.
Once the browser is active, you use the SendKeys command to simulate keyboard shortcuts for selecting and copying data. SendKeys "^{a}" in VBA means "Ctrl+A," which selects all the content on the page. Give another brief pause with Sleep 500 to be safe. Then, SendKeys "^{c}" sends "Ctrl+C" to copy everything selected to the clipboard.
Now the data is in your clipboard, but you need to bring it back into Access. Use AppActivate again, this time with the title of your Access database window. For example:
AppActivate "TechHelp Free Template"
Once Access is in the foreground, decide where you want to paste the data. This might be a text box, for example called StatusBox. Use the SetFocus method:
StatusBox.SetFocus
With the focus in place, either use SendKeys "^{v}" for "Ctrl+V" to paste the contents from your clipboard, or (better) use the following VBA command, which runs the Access Paste command:
DoCmd.RunCommand acCmdPaste
And that is all. This sequence automates the act of loading a page, waiting for it to finish, copying what you see, and returning the information into Microsoft Access without worrying about hidden JavaScript or protected APIs. Here is the full code wrapped together, assuming you have a text box called StatusBox:
' Example VBA code for copying screen data from a website to Access
FollowHyperlink "https://599CD.com" Sleep 1000 ' wait for page to load AppActivate "Computer Learning Zone" Sleep 500 ' brief pause after activating browser SendKeys "^{a}" ' Ctrl+A, select all Sleep 500 SendKeys "^{c}" ' Ctrl+C, copy Sleep 500 AppActivate "TechHelp Free Template" ' switch back to Access StatusBox.SetFocus ' set focus to your text box Sleep 500 DoCmd.RunCommand acCmdPaste ' paste clipboard content
This code can be pasted directly into an Access VBA event, like a button click handler. Remember, Sleep is not a standard VBA function—you need to declare it if you have not before. Use this declaration at the top of your code module:
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
(Be sure to use the correct declaration for your version of Access: the example here is for 64-bit Office.)
There are a few things to remember about this approach. First, timing matters a lot. If your internet connection is slow or the site is busy, you may need to increase the Sleep time to make sure the page is fully loaded before sending Ctrl+A and Ctrl+C commands. If Access or the browser window title changes, adjust the AppActivate parameters accordingly.
While SendKeys is sometimes considered fragile (since it just sends keystrokes to whatever window is in the foreground), it is the only practical way to retrieve the content you can directly see when all background or API methods fail. This is especially true for complex web pages or ones that regularly change their structure to thwart automated scraping.
Remember to use this technique responsibly. If you are only grabbing a handful of pages for personal use—like comparing regular grocery prices or logging your most recent credit card transactions—you are unlikely to run into any trouble. Just do not use this method for mass scraping, which would violate most websites' terms of service.
This practical solution sidesteps all the sophisticated blocks websites put up to protect their content, simply by mimicking what a human would do: select and copy what is on the screen. If you need to process or extract only a certain line or value from the copied data (say, pulling just the price or description), that is a matter of additional string processing in VBA, which you can tailor once you have the raw page content in Access.
To sum up, when API calls and HTML background requests do not return what you see, use Access and a few simple VBA tricks to get what is visible on your screen. Open the page, copy the data, and paste it back into your database. This is an easy, robust, and effective method for anyone who wants to monitor prices, collect statements, or consolidate online data in Access without any special web integration. Give it a try in your next Access project—sometimes, good enough really is good enough.
|