From SQL Server to Excel-macro variable ?

  • How to read data from SQL Server to Excel macro variable ? I'm trying to get rid of using excel sheet area as a temporary storage.

  • If you code post some code we can probably give you a better answer. DTS supports Excel, so you could just import the file into a table and then do pure SQL from there. There are also OLEDB drivers that you can use to open the file directly, with some limitations.

    Andy

  • Not Excel to SQL Server.

    SQL Server (or anything) to Excel with ODBC.

    
    
    With ActiveSheet.QueryTables.Add(Connection:= _
    "ODBC;DSN=ORA2;UID=ca;PWD=*****;DBQ=prod;DBA=W;APA=T;PFC=2;TLO=0;", _
    Destination:=Range("A1"))
    .Sql = Array("SELECT value FROM TABLE") )
    .FieldNames = True
    .RefreshStyle = xlInsertDeleteCells
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .RefreshOnFileOpen = False
    .HasAutoFormat = True
    End With

    How to read this resultset to array-variable?

    Destination:=RANGE("A1")

    to i.e

    Destination:=myvariant

    I believe somebody knows. Thanks in advance!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply