View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mas mas is offline
external usenet poster
 
Posts: 1
Default RowNumber corrupts formatting of Querytable

Hi All !

I have used the Querytable in Excel to display data, I selected from
my Database. The date-fields were formatted as date, the numbers as
numbers. So good so far. Then I decided to use RowNumbers.
After I set RowNumbers=True, the number was displayed as a date and
vice versa.
I found out, that the formatting (date, number) stayed on the column,
where it was before, but the data has moved one column right, because
the RowNumber was inserted in the first column.


Is this a bug in Excel, or did I miss to set a parameter ?


This is my Code:
Table = WSData.QueryTables.Add("ODBC;DSN=" & DSN,
WSData.Range("A1"), SQLText)
XLApp.DisplayAlerts = False
Table.Name = "Abfrage von " + DSN
Table.AdjustColumnWidth = True
Table.BackgroundQuery = True
Table.FieldNames = True
Table.FillAdjacentFormulas = False
Table.PreserveColumnInfo = True
Table.PreserveFormatting = True
Table.RefreshOnFileOpen = False
Table.RefreshPeriod = 0
Table.RefreshStyle = 1
Table.RowNumbers = True
Table.SavePassword = False
Table.SaveData = True
Table.Refresh(True)


Where WSData is my Datasheet and XLApp my Application-Object


Can anyone of you help me ?