View Single Post
  #27   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Web browser question

Hi Brian,

I'm not sure what thread you're referring to, as I'm posting directly to the
MS news servers, and I don't see the initial thread. That said, a webquery
should do what you want here. Since finance.yahoo.com relies on querystring
values (you can see the stock ticker/etc in the browser's address bar), you
should be able to use webqueries. What I would do is start with a default
webquery (http://finance.yahoo.com/q?s=msft or similar), then you can swap
out the "=msft" for "=<stock ticker" when needed through VBA (just look at
the QueryTable object's Connection property).

For sites that utilize Javascript or use POST methods in their forms, it
becomes a bit trickier. But you may be able to use XMLHTTP to submit the
"form" data and retrieve the text from the resulting page. Here's a brief
example of how it can be accomplished:

http://groups-beta.google.com/group/...829784b4ad0c6b

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


braindead wrote:
Tim, Shetty, Sharad, RV,

Thank you, thank you, thank you!! I have been trying to accomplish
just this task (automating Yahoo Finance webpages navigation via vba)
and had given up just about all hope until I discovered this site and
this thread. Being still very new to vba, you all saved me countless
hours of additional trial and error and hunting for info on the web.

That said, I hope some of you are still monitoring this thread
because, of course, I have a couple questions:

ipf.Click

provokes an error -- I got around it by using

Application.SendKeys "~", True

but that makes me nervous because everything I read about SendKeys
tells me it's unreliable. Any sugqestions on clarifying or modifying
the Click event?

Also, my goal is to copy data off the YF pages and into an Excel
spreadsheet. I don't even care about specifying the data to copy, the
whole webpage will do just fine. If I understand correctly, a Web
Query won't work -- or will it? So again, I think I can use the
SendKeys, but is there a more reliable way?

I'm also trying to accomplish the same thing on another website which
does use the Post method for logging in that Tim referenced. Any
success on figuring that one out?

Finally, the latter website uses pull down menus to navigate to other
pages within the site (vs. Yahoo Finances hyperlinks). Can anyone show
me some basic code examples for navigating this type of website
navigation?

Oh, and one more, mostly curiosity question at this point. Can all
this also be accomplished through WebBrowser ActiveX control on a
UserForm? It seems like a handy resource to take advantage of.

Again, thanks so much for all the help!

Regards,

Brian


*** Sent via Developersdex http://www.developersdex.com ***