Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 28th, 2004, 11:40 AM
Authorized User
Join Date: Jul 2003
Location: , , .
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default Downloading Excel File

Hello Everyone and thanks for your help in advance. I have an application that needs to download many files from a website. One of these files is an Excel spreadsheet. My code downloads the file, but when I go to open it, the data is scrambled. I think the problem is that I am encoding it improperly, but can't figure out what I nned to do. The following code is what I am using now:

        'Put user code to initialize the page here
        Dim URL As String = "http://filetoget.xls
        Dim outputfile As String = "C:\filetoget.xls"
        Dim wReq As WebRequest
        Dim wResp As WebResponse
        Dim respStream As Stream
        Dim reader As StreamReader
        Dim writer As StreamWriter

        ' create the Web Request
        wReq = WebRequest.Create(URL)

        ' get the response
        wResp = wReq.GetResponse()
        respStream = wResp.GetResponseStream()
        reader = New StreamReader(respStream, False)

        ' and write it to the required file
        writer = New StreamWriter(outputfile)
        'writer = New BinaryWriter(outputfile)

Could someone get me going in the right direction? Any help is greatly appreciated. Thanks.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloading a File RobC ASP.NET 2.0 Basics 4 February 4th, 2006 09:37 PM
Issue of downloading Excel file(resent) zuolinbai Classic ASP Professional 3 June 15th, 2004 11:10 AM
Issue of downloading Excel file(resent) zuolinbai Classic ASP Basics 1 June 10th, 2004 05:24 PM
Issue of downloading Excel file zuolinbai Classic ASP Professional 1 June 7th, 2004 05:50 PM
Downloading data from Web into Excel Blase Excel VBA 2 October 24th, 2003 09:00 AM

All times are GMT -4. The time now is 07:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.