Excel How to connect to database through Macro Excel in MAC

Joined
Apr 22, 2011
Messages
1
Reaction score
0
Hi All,

Im a beginner in Macro Excel. I have been trying to connect database through Macros. But I am getting the "Run Time Error:429" ActiveX Componenet can't create object


Below is the mentioned code that i have been working on.

/***** Start of code******?
Sub AnalyzeDBA1Tables()
Dim str As String
Dim strSQL As String

Set cnn = CreateObject(“ADODB.Connection”)

cnn.Open ("User ID=scott" & ";Password=tiger" & ";Data Source=**.**.**.**" & ";Provider=*")

Set rs = CreateObject(“ADODB.Recordset”)

row = 5

col = 5

numRs = rs.Fields.Count

num = 0

strSQL = "select * from employee"

rs.Open strSQL, cnn

Do Until rs.EOF

Do While num < numRs

Cells(row, col + num).Value = rs(num)

num = num + 1

Loop

num = 0

row = row + 1

rs.moveNext

Loop

rs.Close

cnn.Close

End Sub

/*****End of code********/

I know after a lot of googling that Activex Object library is not present in MAC Excel 2011. Can you please tell any alternative solutions to connect the database

Please guide me through how to establish the connection.

Your valuable help is required urgently.

Thanx in advance,
Jibanendu
 
Back
Top