Solved

Excel Server

Posted on 2014-03-19
2
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 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