Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to connect SQL Server 2008 and ms excel 2003

Author  Topic 

indianbhav
Starting Member

3 Posts

Posted - 2011-02-24 : 00:34:41
How can I connect excel 2003 and SQL Server 2008 windows authentication through macros?

I am using the tool ms sql server management studio.

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-24 : 00:46:02
Connecting two products through Macros AND using SSMS a bit confusing .... can you explain what you are trying to do?

Cheers
MIK
Go to Top of Page

indianbhav
Starting Member

3 Posts

Posted - 2011-02-24 : 00:48:27
I am trying to connect ms excel 2003 and sql server ,I want to establish a connection between these two so that I export the data into excel by running the queries.

quote:
Originally posted by MIK_2008

Connecting two products through Macros AND using SSMS a bit confusing .... can you explain what you are trying to do?

Cheers
MIK

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-24 : 00:50:08
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-24 : 00:57:21
KH provided a link, check it out ... It has the details of how to export / import data to/from Excel.

Cheers
MIK
Go to Top of Page

indianbhav
Starting Member

3 Posts

Posted - 2011-02-24 : 01:02:18
I am passing the parameters through excel it should run the queries based on that,I thought I will write a macro code to do the same but somehow connection is not getting established ..
I am using the below code

Sub Button1_Click()
Dim sql As String
Dim Event_Name As String
Dim cn As ADODB.Connection
Din cnString as String


cnString = "Provider=MSDASQL.1;Data Source=BIQARPT;Initial Catalog=DataBase;Integrated Security=SSPI;"
cn.Open (cnString)

MsgBox (cn)

Name1= Sheet1.Name

sql = "select emp_id from employee where Name1 = '& Name1 &'"
MsgBox (sql)

End Sub

quote:
Originally posted by khtan

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926


KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-24 : 01:28:56
quote:
Originally posted by indianbhav

I am trying to connect ms excel 2003 and sql server ,I want to establish a connection between these two so that I export the data into excel by running the queries.]

quote:
Originally posted by MIK_2008

Connecting two products through Macros AND using SSMS a bit confusing .... can you explain what you are trying to do?

Cheers
MIK






the above is not the Code which could be run in SQL Server Management Studio and you are now contradicting what you said in your earlier post (above highlighted).

Have you read the details of the given link? and have you tried any of them via SSMS? As i said in my previous reply that the details are mentioned in that link as How Can You Read (or Write) Data from (or into) Excel Through SQL Server Management Studio.



Cheers
MIK
Go to Top of Page
   

- Advertisement -