By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Copy text file from web server to local drive

P: n/a
Is there a way in VBA to copy a file from a web server to a local
drive? Example:
Every morning at 3AM a huge mainframe report is run and a copy of
this report is saved as a text file on a web server:
http://GLJobs.CliffKing.com/Reports_...port101007.txt
The name of my report is:
MyReport101007.txt

I manually download this report to the C:\ drive and then manually
import it into access.
Is there a way i can programmatically do this?

Thanks

Cliff

Oct 11 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Cl*****@gmail.com said the following on 10/10/2007 8:15 PM:
Is there a way in VBA to copy a file from a web server to a local
drive?
I will have to remember the next time I have a VBA question that I
should ask it in a Javascript newsgroup rather than in a VBA group.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 11 '07 #2

P: n/a
Randy Webb wrote on 11 okt 2007 in comp.lang.javascript:
Cl*****@gmail.com said the following on 10/10/2007 8:15 PM:
>Is there a way in VBA to copy a file from a web server to a local
drive?

I will have to remember the next time I have a VBA question that I
should ask it in a Javascript newsgroup rather than in a VBA group.
We will help you remember, Randy.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 11 '07 #3

P: n/a
On Oct 10, 8:15 pm, Clif...@gmail.com wrote:
Is there a way in VBA to copy a file from a web server to a local
drive?
Your post was fine if you just asked "Is there a way in javascript
to..."
On windows you can do this:

Create a text file called c:\GetWebPage.js:

var fso = new ActiveXObject('Scripting.FileSystemObject');
var args = WScript.Arguments;
var url = args(0);
var fileName = args(1);
var xmlhttp=new ActiveXObject("microsoft.xmlhttp");
xmlhttp.open("GET", url, false);
xmlhttp.send();
var data=xmlhttp.responsetext;
var file = fso.CreateTextFile(fileName, 2);
file.writeLine(data);
file.close();
>From a command line type:
cscript /nologo c:\GetWebPage.js http://www.YOUR_URL_HERE.com c:
\YOUR_OUTPUT_FILE_HERE.txt
Oct 11 '07 #4

P: n/a
On Oct 11, 9:19 am, "drink.the.koolaid" <drink.the.kool...@gmail.com>
wrote:
On Oct 10, 8:15 pm, Clif...@gmail.com wrote:
Is there a way in VBA to copy a file from a web server to a local
drive?

Your post was fine if you just asked "Is there a way in javascript
to..."
On windows you can do this:

Create a text file called c:\GetWebPage.js:

var fso = new ActiveXObject('Scripting.FileSystemObject');
var args = WScript.Arguments;
var url = args(0);
var fileName = args(1);
var xmlhttp=new ActiveXObject("microsoft.xmlhttp");
xmlhttp.open("GET", url, false);
xmlhttp.send();
var data=xmlhttp.responsetext;
var file = fso.CreateTextFile(fileName, 2);
file.writeLine(data);
file.close();
From a command line type:

cscript /nologo c:\GetWebPage.jshttp://www.YOUR_URL_HERE.comc:
\YOUR_OUTPUT_FILE_HERE.txt
Thanks for your help!

Oct 11 '07 #5

P: n/a
You're quite welcome. :)

Oct 11 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.