Solved

Excel Server

Posted on 2014-03-19
2
204 Views
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..

Rayne
0
Comment
Question by:Rayne
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39939392
Hi,

pls try

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

Open in new window

Regards
0
 

Author Comment

by:Rayne
ID: 39941000
thank you Rgonzo1971 :)
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

911 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

23 Experts available now in Live!

Get 1:1 Help Now