I cannot get the code referred to by
HTML scraping to work. I get a message
Compile error:
User-defined type not defined
on Line 2
- Dim webBrowser As webBrowser
Apparently Access 2002 does not know what a webBrowser is. I don't understand the code, and can't figure it out if I can't run it. I learn from new examples by stepping thru the code, but this code won't start for me.
Couldn't the entire HTML Source Code be Pasted into Word where it could easily be examined or Saved as Text Only where the entire File can be opened in Access, and each Line analyzed in turn?
I've never tried automation, which I believe this involves. However, I did open Word and paste the entire webpage into it. It took about 45 seconds (hourglass) to do the paste. Even repeated pastes. The clear in preparation for another paste took 10 seconds.
Loading Word has its own time penalty. I don't know enough about Word to create a command button to read the text. So here is a whole new subject to investigate, but I think not now.
As I look at the Word page after the paste, I still can't find the .jpg picture address to download and save. The .gif name is embedded in the image frame, and that name would be enough for my purposes, if I knew enough to get to it. But the time cost is excessive, and I still would have to return to IE and "SaveAs..." the image.
I currently paste my selected area of the webpage into an unbound textbox, assign to a string variable, and scrape it. This gets me all the info I need except the .gif name and the ability to save the .jpg image.
So far, my steps are:
-
1) Press "New Record" button in my Access (myDB)
-
2) Alt+Tab to Microsoft Internet Explorer (IE)
-
and select the correct Tab and/or navigate
-
to the desired web page
-
3) Select desired section of web page
-
4) Cntl+V to copy to clipboard
-
5) Alt+Tab to return to myDB
-
6) Press command button "Paste from Website"
-
7) If MsgBox "GIF not determined", clear with "OK"
-
8) Alt+Tab to return to IE
-
9) RightClick .jpg Image and select "Save Picture As..."
-
Cntl+V to paste file name into dialog
-
(this was generated in step 6
-
and copied to clipboard)
-
Press "Enter" or click "Save" to save image
-
10) Mentally note .gif displayed
-
11) Cntl+Tab to return to myDB
-
12) If 7) displayed msg, Click combobox and
-
select row to note .gif displayed
-
13) Click command button to record that an image
-
was actually acquired & saved.
Although this seems like a clumsy set of instructions, replacing with these doesn't seem to help.
-
1) same as 1) above
-
2) same as 2) above
-
3) Cntl+A Select the entire web page
-
4) Cntl+C Copy web page to clipboard
-
5) Alt+Tab to Word
-
6) Cntl+A Select anything in Word
-
7) Cntl+P Paste selected from step 4,
-
overwriting anything already in Word
-
8) Alt+Tab to myDB
-
9) Press command button "Scrape from Word"
-
10) <<I still have no .jpg image, not sure steps here>>
What I am aiming for (and may not get to) is:
-
1) same as 1) above
-
2) same as 2) above
-
3) Alt+Tab to myDB
-
4) Press command button "Get from Website"