Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA for getting files off internet


Hi all,

I have a basic code that I found off the internet that takes a file
from a specifc web page. For a simple example, it is a historical
price file from Yahoo Finance.

1) The way the code currently runs, it opens up an explorer window and
navigates to the page with the file. Is there a way to tweak my code so
that it appears to grab the page behind the scenes?

2) I get the Save As prompt. Can I automatically save it to a
directory of my choice?

Therefore, when I run the module, no additional screens would have been
created, the file would have been saved to my directory automatically
(all behind the scenes).

Assuming these are pretty easy things to get around with VBA, my next
step would be to loop through all files in a directory. Is it possible
to have VBA recognize the number of csv files located at a specific URL
and loop through and do this process for each one? A reference for
what I am talking about would be something similar to this one:

http://www.census.gov/popest/states/...ST2003-02.html

Anyway, I appreciate any feedback you can provide.


--
Btibert
------------------------------------------------------------------------
Btibert's Profile: http://www.excelforum.com/member.php...fo&userid=8559
View this thread: http://www.excelforum.com/showthread...hreadid=537411

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA for getting files off internet


First of all, many many thanks for your response and willingness t
assist.

I am by no means an expert in VBA, thats for sure, but I went to ru
the macro from alt+F8, and the only thing available was tester. I ra
this, and I got a run-time error '3004'. It occurs on the lin
.savetofile spath ......

Any thoughts?

Second. If you get a second, would you mind going through some of th
lines of code and discussing why they are used and what they are doing
Based on what I know about VBA, I see three sub procedures, but as
mentioned previously, there was only 1 macro. Additionally, there ar
some objects and methods here that I have never seen. I guess, if yo
wouldnt mind, could you add some notes on how this macro was peice
together and what some of it is doing. To a fault, I learn by seein
the final product and trying to peice it together. With this code,
wouldnt even know where to start.

Lastly, what would you suggest as a text so I can learn this type o
programming? My interests lie in this kind of coding (controllin
other apps, data retrieval, data storage, data analysis).

Again, and as always, thank you for any assistance you can provide

--
Btiber
-----------------------------------------------------------------------
Btibert's Profile: http://www.excelforum.com/member.php...nfo&userid=855
View this thread: http://www.excelforum.com/showthread.php?threadid=53741

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default VBA for getting files off internet

What's the *text* of the error message?
Does the folder already exist?

As far as commenting all of the code, that might take longer than I have, but I'll try to cover some of it in a later post.

When running code from Alt+F8, you'll only see non-private routines which do not require any parameters: that why you only see one
choice even though there are 3 procedures. I'm not sure if there is an official definition for "macro": often it's used in the
context of recorded code, but it can be applied to any code which somehow automates a process.

For learning VBA and Excel there are a number of very good books available (search for past threads on this - there was one just
recently).
Or check he
http://j-walk.com/ss/books/index.htm
http://www.informit.com/authors/bio....75871f4b6&rl=1
http://froogle.google.com/froogle?q=...g le&ct=title

If you want to learn about how to automate and interact with web pages from VBA then that is a whole other object model. Most of
my familiarity there is from using javascript in web applications, but the translation to VBA is pretty straightforward.

If you prefer to take this off-line you can contact me directly at: tim j williams at gmail dot com (making the obvious edits...)


Cheers
Tim





"Btibert" wrote in message
...

First of all, many many thanks for your response and willingness to
assist.

I am by no means an expert in VBA, thats for sure, but I went to run
the macro from alt+F8, and the only thing available was tester. I ran
this, and I got a run-time error '3004'. It occurs on the line
savetofile spath ......

Any thoughts?

Second. If you get a second, would you mind going through some of the
lines of code and discussing why they are used and what they are doing?
Based on what I know about VBA, I see three sub procedures, but as I
mentioned previously, there was only 1 macro. Additionally, there are
some objects and methods here that I have never seen. I guess, if you
wouldnt mind, could you add some notes on how this macro was peiced
together and what some of it is doing. To a fault, I learn by seeing
the final product and trying to peice it together. With this code, I
wouldnt even know where to start.

Lastly, what would you suggest as a text so I can learn this type of
programming? My interests lie in this kind of coding (controlling
other apps, data retrieval, data storage, data analysis).

Again, and as always, thank you for any assistance you can provide.


--
Btibert
------------------------------------------------------------------------
Btibert's Profile: http://www.excelforum.com/member.php...fo&userid=8559
View this thread: http://www.excelforum.com/showthread...hreadid=537411



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA for getting files off internet


I actually got it to work. I was examining the code, and there was no
directory called saved. When I created this, the code ran swimmingly.
Thanks a million!

I appreciate your willingness to answer my questions, and will not
hesitate to ask if there is anything that comes up.

As for commenting the code, do not sweat it. I have to learn as I go,
and learning VBA has to take precedence over learning other languages.

Thanks again


--
Btibert
------------------------------------------------------------------------
Btibert's Profile: http://www.excelforum.com/member.php...fo&userid=8559
View this thread: http://www.excelforum.com/showthread...hreadid=537411

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel files open in internet explorer?? Dave F Excel Discussion (Misc queries) 3 October 26th 09 06:11 AM
How do I open temporary internet files mdoyer Excel Discussion (Misc queries) 3 October 12th 09 07:41 AM
Downloading files from the the Internet Megadrone Excel Worksheet Functions 1 November 29th 07 09:49 PM
Delete Temporary internet files junx13[_5_] Excel Programming 7 June 25th 04 12:54 PM
Listing Temporary Internet Files Alan Phang Excel Programming 3 February 11th 04 04:09 AM


All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"