Check out our other answers here https://youtube.com/playlist?list=PLNIs-AWhQzcluqE43JKakRKslaYwCouJu

Get files here https://www.wiseowl.co.uk/vba-macros/videos/vba-ado-net-recordsets/ado-get-column-names/

If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos, you can click this link https://www.wiseowl.co.uk/donate?t=1​ to make a donation. Thanks for watching!

When you copy data from a recordset into an Excel worksheet you don't get the column headings by default. This video shows you two ways to loop through the Fields collection and write out the Name property of each Field object into the worksheet.

Chapters
00:00 The Question
02:09 Counting Through the Fields Collection
03:48 Referring to a Field Object
05:33 Writing Names into the Worksheet
06:40 Using a For Each Loop
09:22 Why Doesn't the Field Class Appear?
13:37 Writing Names into the Worksheet
14:36 Selecting Specific Columns
15:34 Discovering the Column Names in a Workbook

Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, Power BI, DAX, SQL Server, Reporting Services, Analysis Services, Integration Services, ASP.NET, C#, Visual Basic, Microsoft Access and more