PDA

View Full Version : Reading from a Website



magelan
11-12-2012, 08:18 AM
Hi All, Trying to find an answer to this, and nothing on the interwebs seems to have a clear definition for how to do this in VBA

What I want to do is pull the text from this website...

http://www.punoftheday.com/cgi-bin/randompun.pl

if you look at the pun, it is surrounded by a div "dropshadow1" every time, which I figure would be a good way to find the pun and read it [read from <p> to </p> after dropshadow1 is found]

How does VBA handle webpages? I dont know anything about VBA logic regarding websites.

snb
11-12-2012, 02:21 PM
Have a look at the attachment.

magelan
11-12-2012, 02:28 PM
Have a look at the attachment.

What exactly happened there? I dont see any code or anything as to how that data got put into the workbook.

Crocus Crow
11-12-2012, 05:25 PM
A web query works for me; no need to know anything about HTML or VBA. The pun is retrieved into cell A8

snb
11-13-2012, 03:49 AM
Put the cursor in cell A1, right mouseclick , option 'refresh': wait & see.

MS was so kind to offer you some helpfiles and a button to approach them (F1). Search for webquery....