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

Formating Excel using Query Data

Status
Not open for further replies.

jake1016

Programmer
May 23, 2005
6
US
Hi,

I'm trying to get data from a web site and load it into an Excel spreadsheet. Here is the query I'm using:

Public Sub Test1()
myLink = ActiveCell.Hyperlinks(1).Address
With ActiveSheet.QueryTables.Add(Connection:="url;" & myLink, _
Destination:=Range("a1")) 'write web-page to sheet
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.PreserveFormatting = True
.SaveData = True
.Refresh BackgroundQuery:=False
End With

End Sub

One column looks like this on the web page:

1/4
3/3H
4/5
5/8
2/1H
1/1H
6/24
7/DIS


but winds up looking like this:

4-Jan
3/3H
5-Apr
8-May
2/1H
1/1H
24-Jun
7/DIS

It's being treated like a date field and I want it to be treated like a text field. Any help appreciated.
 
Hi,

Format the column as text.

Make sure that the Data/Data Range Parameters has checked to keep the formatting.

Once you have Added your QueryTable, you need only Data/RefreshData

Skip,

[glasses] [red]Be advised:[/red]To be safe on the FOURTH, don't take a FIFTH on the THIRD, or...
You might not come FORTH on the FIFTH! [bomb][tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top