Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Invoke Query Wizard programmatically from automation or VSTO

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Invoke Query Wizard programmatically from automation or VSTO

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Invoke Query Wizard programmatically from automation or VSTO

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default Invoke Query Wizard programmatically from automation or VSTO

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool tip for the UDFs created using vsto se add-in. parmanand Excel Worksheet Functions 1 March 12th 07 03:42 PM
VSTO David12345 Excel Discussion (Misc queries) 2 December 27th 05 08:14 PM
Invoke Query Wizard programmatically from automation or VSTO [email protected] Excel Programming 0 October 15th 04 12:09 AM
VSTO Excel Addin JK Excel Programming 0 April 14th 04 09:26 PM
VSTO 2.0 No Name Excel Programming 1 December 8th 03 09:02 PM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"