Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am working on a macro that I'd like to insert a query table into a new workboook. To get the code for the create query part, I used the macro recorder. Workbooks.Add With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=pma;UID=;;SERVER=pma;", Destination:=Range("A1")) .CommandText = Array( _ "Select * from acct_dim") .Name = "Query from pma" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With Without doing anything I just ran the macro again to test it and it faults at .Refresh BackgroundQuery:=False with RunTime '1004' Application-defined or object-defined error Any ideas what could be causing the problem? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Query worksheets in same workbook | Excel Worksheet Functions | |||
Need to Query data on the same Workbook | Excel Programming | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
workbook open query | Excel Programming |