Excel Server

Posted on 2014-03-19
Last Modified: 2014-03-19
Hello All,

When I am grabbing sql server table via vba into a excel, its only grabbing the data rows but Not the column header row - how can i get it so that the data row comes with the headers row too? can someone assist..

Question by:Rayne
LVL 48

Accepted Solution

Rgonzo1971 earned 500 total points
Comment Utility

pls try

With rsRecordSet
     For Idx = 1 To .Fields.Count
         ActiveSheet.Cells(1, Idx) = .Fields(Idx - 1).Name
End With
ActiveSheet.Range("A2").CopyFromRecordset rsRecordSet

Open in new window


Author Comment

Comment Utility
thank you Rgonzo1971 :)

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now