Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there anyway to dynamically invoke Query Wizard or Microsoft Query
programmatically from automation or VSTO? The Query Wizard is the one that comes up in the menu: Data\Import External Data\New Database Query I need this to build SQL statement to import data from a SQL server. Any help with this is greatly appreciated. Regards, GoldTree |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have you tried recording a macro?
Sub mcrDemoSQL() ' ' mcrDemoSQL Macro ' Macro recorded 11/1/2004 by MacroChaotic' ' With ActiveSheet.QueryTables.Add(Array(Connection:=("OD BC;DRIVER=SQL Server;SERVER=yourmomma;UID=yourdaddy;DATABASE=you rdata;Trusted_Connection=Yes"), Destination:=Range("A1")) .CommandText = Array("SELECT getdate()") .Name = "Sample Query" .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 End Sub " wrote: Is there anyway to dynamically invoke Query Wizard or Microsoft Query programmatically from automation or VSTO? The Query Wizard is the one that comes up in the menu: Data\Import External Data\New Database Query I need this to build SQL statement to import data from a SQL server. Any help with this is greatly appreciated. Regards, GoldTree |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the relply.
But I am looking for ways to show the "Query Wizard" programmatically from Automation or VSTO. Thanks, " "MacroChaotic" wrote: Have you tried recording a macro? Sub mcrDemoSQL() ' ' mcrDemoSQL Macro ' Macro recorded 11/1/2004 by MacroChaotic' ' With ActiveSheet.QueryTables.Add(Array(Connection:=("OD BC;DRIVER=SQL Server;SERVER=yourmomma;UID=yourdaddy;DATABASE=you rdata;Trusted_Connection=Yes"), Destination:=Range("A1")) .CommandText = Array("SELECT getdate()") .Name = "Sample Query" .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 End Sub " wrote: Is there anyway to dynamically invoke Query Wizard or Microsoft Query programmatically from automation or VSTO? The Query Wizard is the one that comes up in the menu: Data\Import External Data\New Database Query I need this to build SQL statement to import data from a SQL server. Any help with this is greatly appreciated. Regards, GoldTree |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to do this as well.
the help in MS Query recommend to use DDE. But since DDE is technology used in VB 3 and VB4, can't really find any reference how to do it. u can click on help in the MS Query and there is a section on DDE. rgrds, James " wrote: Thanks for the relply. But I am looking for ways to show the "Query Wizard" programmatically from Automation or VSTO. Thanks, " "MacroChaotic" wrote: Have you tried recording a macro? Sub mcrDemoSQL() ' ' mcrDemoSQL Macro ' Macro recorded 11/1/2004 by MacroChaotic' ' With ActiveSheet.QueryTables.Add(Array(Connection:=("OD BC;DRIVER=SQL Server;SERVER=yourmomma;UID=yourdaddy;DATABASE=you rdata;Trusted_Connection=Yes"), Destination:=Range("A1")) .CommandText = Array("SELECT getdate()") .Name = "Sample Query" .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 End Sub " wrote: Is there anyway to dynamically invoke Query Wizard or Microsoft Query programmatically from automation or VSTO? The Query Wizard is the one that comes up in the menu: Data\Import External Data\New Database Query I need this to build SQL statement to import data from a SQL server. Any help with this is greatly appreciated. Regards, GoldTree |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Tool tip for the UDFs created using vsto se add-in. | Excel Worksheet Functions | |||
VSTO | Excel Discussion (Misc queries) | |||
Invoke Query Wizard programmatically from automation or VSTO | Excel Programming | |||
VSTO Excel Addin | Excel Programming | |||
VSTO 2.0 | Excel Programming |