#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default File copy

Hi,

I would like to be able to put a button in a workbook to copy a file
from a web address to a location on my hard drive, but neither
FileCopy/CopyFile (API version)/ScriptingObject seem to be able to do
it.

I would like to do this:

CopyFile "http://a.b.c/test.xls","c:\test.xls"

Is it possible??

Cheers

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default File copy

Thanks for the reply Don.

I have tried doing something similar, but I need to do a straight copy,
without opening the workbook/s.

I am stuck now.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default File copy

Hi Don,

Found out how to do it and wanted to share with the group ..

Put the following in a module:

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

then create a wrapper:

Public Function DownloadFile(ByVal sURL As String, ByVal sLocalFile As
String) As Boolean
Dim lngRetVal As Long
DownloadFile = URLDownloadToFile(0&, sURL, sLocalFile, 0&, _
0&) = 0
End Function

then you can do:

DownloadFile("http://www.a.b.c/afile.zip","c:\afile.zip")

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 data for match word from one file to another file mishak Excel Worksheet Functions 1 December 2nd 09 02:11 AM
How do I copy a excel file into a InDesign file correctly? cfb Excel Discussion (Misc queries) 2 June 14th 07 10:08 PM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file [email protected] Setting up and Configuration of Excel 0 March 14th 07 02:13 AM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
VBA Macro to copy an column from one Excel file into another file Sam Excel Programming 4 July 3rd 05 03:36 AM


All times are GMT +1. The time now is 06:39 AM.

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"