Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Excel Server

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
Rayne
Asked:
Rayne
1 Solution
 
Rgonzo1971Commented:
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
 
RayneAuthor Commented:
thank you Rgonzo1971 :)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now