Hi all,
Been searching for hours into the wee morning about this but to no avail.
I'm running a QueryTable (first time using this) to scrape some csv info from a webpage...then I format/clean the scraped data.
This works on the first time, but not on the second/third/fourth, etc time. By formatting/cleaning the data, I mean I use a "text to column" macro on the letter T.
After I end the macro. And modify the url/link to do this process for another company, the scraped info is MISSING A T (!!!)
Really strange...I've already ended the macro and I modify the url to do a new scrape...but somehow the scraped/queried data is Missing a T (the "text to column" cutoff point I specified after the first query.
Any ideas on this? Thank you & Much appreciated
Sub Import_CSV_File_From_URL()
' https://www.mrexcel.com/forum/excel-questions/686700-import-csv-file-web-vba.html
Dim URL As String
Dim destCell As Range
URL = "http://mylinkhere.com/company1"
Set destCell = Range("A1")
With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & URL, Destination:=destCell)
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True
.Refresh BackgroundQuery:=False
End With
Next ... I use a the "text to column' in a macro
For this dataset, I use the letter "T" as a separating point.
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="T", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Been searching for hours into the wee morning about this but to no avail.
I'm running a QueryTable (first time using this) to scrape some csv info from a webpage...then I format/clean the scraped data.
This works on the first time, but not on the second/third/fourth, etc time. By formatting/cleaning the data, I mean I use a "text to column" macro on the letter T.
After I end the macro. And modify the url/link to do this process for another company, the scraped info is MISSING A T (!!!)
Really strange...I've already ended the macro and I modify the url to do a new scrape...but somehow the scraped/queried data is Missing a T (the "text to column" cutoff point I specified after the first query.
Any ideas on this? Thank you & Much appreciated
Sub Import_CSV_File_From_URL()
' https://www.mrexcel.com/forum/excel-questions/686700-import-csv-file-web-vba.html
Dim URL As String
Dim destCell As Range
URL = "http://mylinkhere.com/company1"
Set destCell = Range("A1")
With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & URL, Destination:=destCell)
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True
.Refresh BackgroundQuery:=False
End With
Next ... I use a the "text to column' in a macro
For this dataset, I use the letter "T" as a separating point.
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="T", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True