Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Copy A File From Internet To My Desktop

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)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy A File From Internet To My Desktop

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)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Copy A File From Internet To My Desktop

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)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default Copy A File From Internet To My Desktop

Hi Edmund,

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

Dan
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy A File From Internet To My Desktop

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy A File From Internet To My Desktop

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
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
Copy cell from Excel file and paste into control on internet page Qaspec Excel Programming 0 September 6th 07 06:38 PM
How to copy a file from internet to local drive on VBA Kapa Excel Programming 0 April 9th 07 07:56 PM
It saves a copy on my desktop with a different file name? Alis M. Setting up and Configuration of Excel 2 December 13th 06 06:21 PM
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? [email protected] Setting up and Configuration of Excel 2 November 27th 04 09:02 PM
Download (copy) file from the internet Jos Vens Excel Programming 1 February 3rd 04 02:14 PM


All times are GMT +1. The time now is 10:42 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"