sandbagger
10-13-2008, 07:55 PM
i am trying to import a .csv file linked from a website. i can get it imported into excel but i can't figure out how to tell excel to import it as a delimited file.
my code below imports each row into one big cell like this:
"aaa,bbb,ccc"
i want it imported such that "aaa","bbb", and "ccc" are in adjacent cells
i know when importing a local csv file you can set
.TextFileCommaDelimiter = True
and am after something like that.
Dim url As String
url = "URL;http://www.investis.com/chartsource/csvdownload.csv?symbol=UBS.N&startday=14&startmonth=10 _
&startyear=2007&endday=14&endmonth=10&endyear=2008&btnSubmitCvs.x=41&btnSubmitCvs.y=5"
With ActiveSheet.QueryTables.Add(Connection:=url, Destination:=Range("I4"))
.Name = "test"
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
my code below imports each row into one big cell like this:
"aaa,bbb,ccc"
i want it imported such that "aaa","bbb", and "ccc" are in adjacent cells
i know when importing a local csv file you can set
.TextFileCommaDelimiter = True
and am after something like that.
Dim url As String
url = "URL;http://www.investis.com/chartsource/csvdownload.csv?symbol=UBS.N&startday=14&startmonth=10 _
&startyear=2007&endday=14&endmonth=10&endyear=2008&btnSubmitCvs.x=41&btnSubmitCvs.y=5"
With ActiveSheet.QueryTables.Add(Connection:=url, Destination:=Range("I4"))
.Name = "test"
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With