Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Unanswered: ODBC connection string

    can anyone help me out how to write the connection string ODBC. I want to connect sybase database to excel. Please help me im new to this.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Just create an ODBC data source and use that from excel
    You looking for something like this?
    Code:
    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 13/11/2007 by PDreyer
    '
    
    '
        With ActiveSheet.QueryTables.Add(Connection:= _
            "ODBC;DRIVER={Sybase ASE ODBC Driver};NA=host1,4100;DB=master;UID=PDreyer;" _
            , Destination:=Range("A1"))
            .CommandText = Array( _
            "SELECT sysdatabases.name" & Chr(13) & "" & Chr(10) & "FROM master.dbo.sysdatabases sysdatabases")
            .Name = "Query from srv1"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = True
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .PreserveColumnInfo = True
            .Refresh BackgroundQuery:=False
        End With
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •