PC Review


Reply
Thread Tools Rate Thread

Copy A File From Internet To My Desktop

 
 
Edmund
Guest
Posts: n/a
 
      21st Apr 2008
What are the codes to copy a text file from the internet location
"http://www.myweb.com/myfolder/TheTextFile.txt" to my local C drive as
"C:\TheTextFile.txt"?

I tried FileCopy but to no avail.

Thanks in advance.

--
Edmund
(Using Excel 2000)
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      21st Apr 2008
Set fsmove = CreateObject("Scripting.FileSystemObject")

FName = "http://www.myweb.com/myfolder/TheTextFile.txt"

Set MyFile = fsmove.getfile(FName)
SName = MyFile.shortname

fsmove.CopyFile FName, "c:\" & SName

"Edmund" wrote:

> What are the codes to copy a text file from the internet location
> "http://www.myweb.com/myfolder/TheTextFile.txt" to my local C drive as
> "C:\TheTextFile.txt"?
>
> I tried FileCopy but to no avail.
>
> Thanks in advance.
>
> --
> Edmund
> (Using Excel 2000)

 
Reply With Quote
 
Edmund
Guest
Posts: n/a
 
      21st Apr 2008
Thanks for helping but I got "Run-time error '53': File not found" at line
"Set MyFile = fsmove.getfile(FName)"

I tested with:
FName = "http://www.cpearson.com/Zips/modActivateExcel.zip"

What's wrong?

--
Edmund
(Using Excel 2003 & 2000)

 
Reply With Quote
 
dan dungan
Guest
Posts: n/a
 
      22nd Apr 2008
Hi Edmund,

I think it might be that a .zip file is not a .txt file.

Dan
 
Reply With Quote
 
poirot
Guest
Posts: n/a
 
      22nd Apr 2008
Hi Edmund, try this

Private Declare Function URLDownloadToFile Lib "urlmon" Alias
"URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As
String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Dim llRetVal As Long

Sub Download()
llRetVal = URLDownloadToFile(0, "http://www.cpearson.com/Zips/
modActivateExcel.zip", "c:\modActivateExcel.zip", 0, 0)

End Sub

______________________
Nuno Rocha
 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      22nd Apr 2008
I can't get Chip's file to download. chip may have access priviledges on his
file that doesn't allow copying the file. But try your code again except
remove the "http:" from the file name . I forgot when you access a file from
the web excel doesn't like the http

from
FName = "http://www.myweb.com/myfolder/TheTextFile.txt"
to
FName = "//www.myweb.com/myfolder/TheTextFile.txt"


"Edmund" wrote:

> Thanks for helping but I got "Run-time error '53': File not found" at line
> "Set MyFile = fsmove.getfile(FName)"
>
> I tested with:
> FName = "http://www.cpearson.com/Zips/modActivateExcel.zip"
>
> What's wrong?
>
> --
> Edmund
> (Using Excel 2003 & 2000)
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy file via Remote Desktop? Harry Whitehouse Windows XP Security 1 28th Jun 2006 07:08 PM
How do I drag doc from desktop to new file? will only copy 2 file =?Utf-8?B?TWVybWFpZDdzZWFz?= Microsoft Word Document Management 1 4th May 2006 04:46 PM
Copy file from PPC to desktop cvh Microsoft Dot NET Compact Framework 4 19th Apr 2005 08:51 PM
Batch file to copy a file on Desktop Irshad Alam Windows XP General 2 5th Sep 2004 05:03 PM
RE: Copy text file from device to desktop (and from desktop) =?Utf-8?B?RGFuIEFyZGVsZWFu?= Microsoft Dot NET Compact Framework 0 22nd Jun 2004 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:23 AM.