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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Format and QueryTables result

Status
Not open for further replies.

sandoztek

Programmer
Aug 20, 2008
27
FR
I am using the code below to retrieve data from a web site:
With ActiveSheet.QueryTables.Add(Connection:=destinationURL, Destination:=Range("a1"))
.WebTables = "10,11,12,13,14,15,16,17"
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
one column in the web site contains strings with values such as 11/2 that I want to retrieve as is, but in the Excel sheet I get a date,that is, 11-feb.
I have forced the column format to Text, but it doesn't fix the problem.
What should be done?
 




Check out faq68-5827.

"...but in the Excel sheet I get a date,that is, 11-feb."

You actually are getting the DATE VALUE for Feb 11, 2008. This is Excel being helpful. The FAQ will tell you why.

I'd suggest using ADO. I do not exactly know how, because I have never used ADO for a web query. But once you have retrieved a recordset, you can then write each data element to the sheet, and prefix the data in the offending column with an apostrophy.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top