Simple using ADO.
Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary
sConnect = "Provider=Sybase.ASEOLEDBProvider;" & _
"Srvr=myASEServer,5000;" & _
"Catalog=myDBName;" & _
"User Id=myUserName;" & _
"Password=myUserPassword"
sSQL = "SELECT * From TableName"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText
' Check to make sure we received data.
Worksheets("Sheet1").Range("A1").CopyFromRecordset oRS
oRS.Close
Set oRS = Nothing
End Sub
But see
http://www.carlprothman.net/Default....rverEnterprise
for some notes.
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Arvi Laanemets" wrote in message
...
Hi
I need to read some data from Sybase database and create an Excel chart
based on this data.
I can create a pass-through query in Access, but I don't like Access chart
designer, and I prefer Excel to create charts, when possible. Having the
query in Access and chart in Excel will be somewhat cumbersome. Is there a
way to run a Sybase pass-through query from Excel (probably from some
procedure), and how to do it? (I have a Data Source for connection to
Sybase database - let it be MySource - defined on my computer, and I can
get a working SQL-string from my Access test application)
Thanks in advance
--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )