Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey everyone, I just found this board. I wrote some VBA
to query my SQL Server into a recordset, but I don't know how to display that recordset on my Excel spreadsheet. The recordset is full, so how do I put that into Excel? Here is the Last few lines of my code: 'Create Recordset rstIVSLH.CursorType = adOpenForwardOnly rstIVSLH.LockType = adLockReadOnly rstIVSLH.CursorLocation = adUseClient Set rstIVSLH = conSQLSERVERConnection.Execute(strSQL) 'ActiveSheet.Rows(3) = rstIVSLH.Fields ??????????????????? End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ActiveSheet.Range("A3").CopyFromRecordSet rstIVSLH
Regards, Tom Ogilvy "Alex A" wrote in message ... Hey everyone, I just found this board. I wrote some VBA to query my SQL Server into a recordset, but I don't know how to display that recordset on my Excel spreadsheet. The recordset is full, so how do I put that into Excel? Here is the Last few lines of my code: 'Create Recordset rstIVSLH.CursorType = adOpenForwardOnly rstIVSLH.LockType = adLockReadOnly rstIVSLH.CursorLocation = adUseClient Set rstIVSLH = conSQLSERVERConnection.Execute(strSQL) 'ActiveSheet.Rows(3) = rstIVSLH.Fields ??????????????????? End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Awesome! Thanks. You're Kung foo is the best.
Alex. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Tom, or anyone... Along with this solution is there a way to return the Header too, meaning the column names for the rows returned? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim TargetRange as Range
set Target.Range = ActiveSheet.Range("A3") For intColIndex = 0 To rs.Fields.Count - 1 ' the field names TargetRange.Offset(0, intColIndex). _ Value = rstIVSLH.Fields(intColIndex).Name Next TargetRange.Offset(1, 0).CopyFromRecordset _ rstIVSLH ' the recordset data -- Regards, Tom Ogilvy "Alex" wrote in message ... Tom, or anyone... Along with this solution is there a way to return the Header too, meaning the column names for the rows returned? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's awesome man. Thanks again. You have showed me
the way to Yellow Belt in Kung VBA Foo. :} Take Care, Alex. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2000 - VBA - Stop recordset Data from auto converting | Excel Programming | |||
Excel 2000 VBA recordset manipulation | Excel Programming | |||
Recordset | Excel Programming | |||
Recordset Opening Excel File | Excel Programming | |||
open range (within workbook) as ado recordset - excel vba | Excel Programming |