Web Query - Unwanted Scientific Formatting

Audri

New Member
Joined
Mar 24, 2002
Messages
5
I'm performing a web query on a html file containing nbrs having an embedded "E". Excel formats the data as scientific; I need to have a text format. I've tried using a .txt extention on the file and preformatting the cell as text prior to performing the web query. I need to be able to work with the html file as it is currently formatted (ie: adding a ' in front of the data is not an option).

By the time Excel completes loading the sheet, it has already changed the VALUE of the data as well as the format. Is there a way to add a ' in front of the data during the Web Query operation, or to otherwise prevent conversion of the data?

Here is my code:

Sub BondsEquityAccts()

ActiveWorkbook.Worksheets.Select
Load LoadMsg
LoadMsg.Show (vbModeless)

'try to prevent scientific formating
'(didn't work)
'
Columns("C:C").NumberFormat = "@"

Application.ScreenUpdating = False

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://s390/SharedApplications/servlet/WIORDY1.TXT" _
, Destination:=Range("A1"))
.Name = "BondsEquityAccts"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.Refresh BackgroundQuery:=False
End With

'try again to prevent scientific formating
'(didn't work)
Columns("C:C").NumberFormat = "@"

Application.ScreenUpdating = True
LoadMsg.Hide

End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Why don't you try to do a find search and replace all the "E" with another character string and then import the text to excel.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,520
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top