I have an Excel workbook with four sheets inside and each one contains the results of a Database query I have setup. The way the table is populated is via a stored procedure in Sybase. I’d like to amend the spreadsheet so that it calls the stored procedure, I can then refresh the queries and the data shown.
I am familiar with writing VBA and done some research and have the following code,
Dim con As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Set con = New ADODB.Connection
Set cmd = New ADODB.Command
con.Open "DSN"
cmd.ActiveConnection = con
cmd.CommandText = "spname"
But it comes back with a compile error “Invalid outside procedure” highlighting the initial Set statement.
If someone can help\advise on how I can write a procedure in the Excel VBA to call a stored procedure in Sybase.
I am familiar with writing VBA and done some research and have the following code,
Dim con As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Set con = New ADODB.Connection
Set cmd = New ADODB.Command
con.Open "DSN"
cmd.ActiveConnection = con
cmd.CommandText = "spname"
But it comes back with a compile error “Invalid outside procedure” highlighting the initial Set statement.
If someone can help\advise on how I can write a procedure in the Excel VBA to call a stored procedure in Sybase.