Home All Groups Group Topic Archive Search About

Expot datas in to excel sheet

Author
11 Oct 2005 11:20 AM
raja
how can i export the data which is returned in aquery intto an excel
sheet.

Raja

*** Sent via Developersdex http://www.developersdex.com ***

Author
11 Oct 2005 1:40 PM
Jeff Johnson [MVP: VB]
<raja> wrote in message news:OJXr%23WlzFHA.1256@TK2MSFTNGP09.phx.gbl...

> how can i export the data which is returned in aquery intto an excel
> sheet.

Is Excel installed on the machine that will be running this code? And what
data access method are you using to run this "query"? DAO? ADO?
Author
11 Oct 2005 3:14 PM
Paul Clement
On Tue, 11 Oct 2005 04:20:09 -0700, raja <raja> wrote:

¤ how can i export the data which is returned in aquery intto an excel
¤ sheet.
¤

What is the source of your data?


Paul
~~~~
Microsoft MVP (Visual Basic)
Author
12 Oct 2005 5:59 AM
raja
sql Server2000 is the source
raja

*** Sent via Developersdex http://www.developersdex.com ***
Author
12 Oct 2005 3:40 PM
Paul Clement
On Tue, 11 Oct 2005 22:59:27 -0700, raja <raja> wrote:

¤
¤ sql Server2000 is the source
¤ raja

See if the following works for you:

Dim cnn As New ADODB.Connection
Dim strSQL As String

cnn.Open _
   "Provider=Microsoft.Jet.OLEDB.4.0;" & _
   "Data Source=e:\My Documents\Book200.xls;Extended Properties=Excel 8.0;"

strSQL = "SELECT * INTO [Orders] FROM [Orders] IN '' [ODBC;Driver={SQL
Server};Server=(local);Database=Northwind;Trusted_Connection=yes];"

cnn.Execute strSQL

cnn.Close
Set cnn = Nothing


Paul
~~~~
Microsoft MVP (Visual Basic)
Author
12 Oct 2005 5:57 AM
raja
The source of my data is The SqlServer2000 (ADO)

raja

*** Sent via Developersdex http://www.developersdex.com ***