Hello EE (Excel Experts),

 

I have one VBA subroutine which download CSV file from website. This works
fine on any normal connection internet. But the moment I connect my laptop
through Wifi, it flags an error Run time error '2146697208' "The download of
the Specified resource has failed"

 

This is the code.

 

' To Download from site***************************

Function Download_File(ByVal vWebFile As String, ByVal vLocalFile As String)
As Boolean

    Dim oXMLHTTP As Object, i As Long, vFF As Long, oResp() As Byte

    

    Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP")

    oXMLHTTP.Open "GET", vWebFile, False 'Open socket to get the website

    oXMLHTTP.Send 'send request

    

    'Wait for request to finish

    Do While oXMLHTTP.readyState <> 4

    DoEvents

    Loop

    

    oResp = oXMLHTTP.responseBody 'Returns the results as a byte array

    

    'Create local file and save results to it

    vFF = FreeFile

    If Dir(vLocalFile) <> "" Then Kill vLocalFile

    Open vLocalFile For Binary As #vFF

    Put #vFF, , oResp

    Close #vFF

    

    'Clear memory

    Set oXMLHTTP = Nothing

End Function

 

Request you kindly help me get rid of this error so that I can do my work in
Wifi mode as well.

 

Thanks & Regards

Vishvesh

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to