Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

go to web page download file in vbscript

Status
Not open for further replies.

lovettj

Programmer
May 22, 2007
10
US
I am trying to write a vbscript to go to a website and down load a file in .csv file extension. I don't know where to start so any help will do.

Thanks a lot in advance.
 
dm4ever

I reviewed the link that you sent me. It is close but my problem is that when i navigate to the url string I get the following popup telling me to download

open save cancel
name:VendorListPublic_county_20070522.csv
type: Microsoft Excel Worksheet,
from: offender.fdle.stat.fl.us
PS: It is asking me to save to a file I want to automate this process
 
That's interesting...I just tried it with the link you provided and it worked fine.

Code:
Option Explicit

Dim DataBin 
Dim HTTPGET 
Set HTTPGET = CreateObject("Microsoft.XMLHTTP") 
HTTPGET.Open "GET", "[URL unfurl="true"]http://offender.fdle.state.fl.us/offender/vendorReport.do?mode=manual&email=emailaddress&county=countyname",[/URL] False 
HTTPGET.Send 
DataBin = HTTPGET.ResponseBody 
Const adTypeBinary=1 
Const adSaveCreateOverWrite=2 
Dim SendBinary 
Set SendBinary = CreateObject("ADODB.Stream") 
SendBinary.Type = adTypeBinary 
SendBinary.Open 
SendBinary.Write DataBin 
SendBinary.SaveToFile "c:\temp\offender.csv", adSaveCreateOverWrite

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
dm4ever

I tried it and it also worked for me.

Thanks again. I really appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top