Hi All,
Im a beginner in Macro Excel. I have been trying to connect database through Macros. But I am getting the "error error 424 object required". Iam using MAC.
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********/
Please guide me through how to establish the connection.
Your valuable help is required urgently.
Thanx in advance,
Jibanendu
Im a beginner in Macro Excel. I have been trying to connect database through Macros. But I am getting the "error error 424 object required". Iam using MAC.
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********/
Please guide me through how to establish the connection.
Your valuable help is required urgently.
Thanx in advance,
Jibanendu