A
Alex Zhang
I am writing a block of Visual Basic code for use with
Excel:
With ActiveSheet.QueryTables.Add
(Connection:=connectionString, _
Destination:=Range("A1"))
.CommandText = SQLText
.Name = DataSourceName & "Query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
However, at the statement ".Refresh
BackgroundQuery:=False", I got a
run-time error 1004: Application-defined or object-
defined error.
The strange thing is that the same query worked well for
a few days before ...
Does anyone know what is the cause of the problem? How I
can solve this problem? Please help!
Thank you very much.
Alex.
Excel:
With ActiveSheet.QueryTables.Add
(Connection:=connectionString, _
Destination:=Range("A1"))
.CommandText = SQLText
.Name = DataSourceName & "Query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
However, at the statement ".Refresh
BackgroundQuery:=False", I got a
run-time error 1004: Application-defined or object-
defined error.
The strange thing is that the same query worked well for
a few days before ...
Does anyone know what is the cause of the problem? How I
can solve this problem? Please help!
Thank you very much.
Alex.