PC Review


Reply
Thread Tools Rate Thread

Download zip file & extract/open excel file

 
 
Mika
Guest
Posts: n/a
 
      27th May 2007
Hi,

I need to download with vba a zip file from the web and then extract/
open the spreadsheet (data.xls) in it. How can I do that ?

I guess something like this:

TaskID = Shell("C:\WINZIP\WINZIP32.EXE\ " & MyFile .....

Thanks for your interest and time...

Mika

 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      27th May 2007
Hi Mika

See my zip pages for the unzip part
http://www.rondebruin.nl/zip.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mika" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hi,
>
> I need to download with vba a zip file from the web and then extract/
> open the spreadsheet (data.xls) in it. How can I do that ?
>
> I guess something like this:
>
> TaskID = Shell("C:\WINZIP\WINZIP32.EXE\ " & MyFile .....
>
> Thanks for your interest and time...
>
> Mika
>

 
Reply With Quote
 
Mika
Guest
Posts: n/a
 
      27th May 2007
Geweldig Ron !

Those functions tell me how to unzip the file once I got it, but couldn
īt find first how to download the zip within excel. I canīt/donīt want
to dowload it manualy but all with vba. Did I miss something in your
site ?

Rg
Mika

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      27th May 2007
I answer this
>See my zip pages for the unzip part


For the download part
Do you always want to save the same file from a website


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mika" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Geweldig Ron !

Those functions tell me how to unzip the file once I got it, but couldn
īt find first how to download the zip within excel. I canīt/donīt want
to dowload it manualy but all with vba. Did I miss something in your
site ?

Rg
Mika

 
Reply With Quote
 
Mika
Guest
Posts: n/a
 
      27th May 2007
Yes Ron,

It is always the same filename but the spreadsheet inside has update
data every week.

Rg
Mika

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      27th May 2007
Hi Mika

Never try this myself with a zip file
I have done it with workbooks.

I think about it tomorrow


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mika" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Yes Ron,
>
> It is always the same filename but the spreadsheet inside has update
> data every week.
>
> Rg
> Mika
>

 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      27th May 2007
Try this:
'***************************************
'get a file from a URL and save it to the specified path
Sub DownloadFile(sURL As String, sPath As String)
Dim oXHTTP As Object, oStream As Object

Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
Set oStream = CreateObject("ADODB.Stream")

oXHTTP.Open "GET", sURL, False
oXHTTP.send

With oStream
.Type = adTypeBinary
.Open
.Write oXHTTP.responseBody
.SaveToFile sPath, adSaveCreateOverWrite
.Close
End With

Set oXHTTP = Nothing
Set oStream = Nothing
End Sub
'****************************************

Tim

"Mika" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes Ron,
>
> It is always the same filename but the spreadsheet inside has update
> data every week.
>
> Rg
> Mika
>



 
Reply With Quote
 
Mika
Guest
Posts: n/a
 
      27th May 2007
Thank you,

Solved, found in the api:

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
Public Function DownloadFile(URL As String, LocalFilename As String)
As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
'example by Matthew Gates ((E-Mail Removed))
DownloadFile "http://www.allapi.net", "c:\allapi.htm"
End Sub

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      27th May 2007
Thanks Tim

Now I remember
You have posted this example more I believe

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Tim Williams" <timjwilliams at gmail dot com> wrote in message news:ejT%(E-Mail Removed)...
> Try this:
> '***************************************
> 'get a file from a URL and save it to the specified path
> Sub DownloadFile(sURL As String, sPath As String)
> Dim oXHTTP As Object, oStream As Object
>
> Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
> Set oStream = CreateObject("ADODB.Stream")
>
> oXHTTP.Open "GET", sURL, False
> oXHTTP.send
>
> With oStream
> .Type = adTypeBinary
> .Open
> .Write oXHTTP.responseBody
> .SaveToFile sPath, adSaveCreateOverWrite
> .Close
> End With
>
> Set oXHTTP = Nothing
> Set oStream = Nothing
> End Sub
> '****************************************
>
> Tim
>
> "Mika" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Yes Ron,
>>
>> It is always the same filename but the spreadsheet inside has update
>> data every week.
>>
>> Rg
>> Mika
>>

>
>

 
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
in vb.net how to open a file from file download prompt without askinguser to save it or run it....just open it in internet explorer Kaustubh Budukh Microsoft Dot NET 4 23rd Jun 2008 10:10 PM
How do I download and open a CSV file in Excel 2000? =?Utf-8?B?RG91ZyBQ?= Microsoft Excel Setup 1 12th Mar 2006 11:32 PM
want to download csv file from website and need to open in Excel. =?Utf-8?B?SmVmZg==?= Microsoft Excel Misc 2 17th Jan 2006 05:35 PM
what to download to open excel spreadsheet file? =?Utf-8?B?Y29tcHV0ZXJkdW1ieQ==?= Microsoft Excel Misc 3 24th Sep 2004 08:49 PM
download and open excel file from outlook Antonis Microsoft Excel Programming 3 15th Oct 2003 04:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:09 AM.