Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have queries stored in -- \Application Data\Microsoft\Queries. I'd like to
run them from an Excel macro. Does anyone know how to code? thanks, Bill B |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I ran a macro and modified it a little.
'/=================================================/ Sub Macro1() Dim strConnection As String Dim strFullFileName As String, strFolder As String Dim strQueryName As String strQueryName = "DeleteMe" strFolder = "D:\Temp\" strFullFileName = _ strFolder & strQueryName & ".dqy" strConnection = "FINDER;" & strFullFileName With ActiveSheet.QueryTables.Add( _ Connection:=strConnection, _ Destination:=Range("A1")) .Name = strQueryName .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With End Sub '/=================================================/ HTH, Gary Brown "Bill B" wrote: I have queries stored in -- \Application Data\Microsoft\Queries. I'd like to run them from an Excel macro. Does anyone know how to code? thanks, Bill B |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
another macro query - deleting a worksheet within a query | Excel Discussion (Misc queries) | |||
Need to Query Excel File Opened by Another User | Excel Discussion (Misc queries) | |||
Excel data query locks source file | Excel Discussion (Misc queries) | |||
VB Code or Excel macro to run Query/Import on Access file | Excel Programming | |||
Excel query in a macro | Excel Programming |