View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kirk P. Kirk P. is offline
external usenet poster
 
Posts: 66
Default ADO Recordset include Field names

Perfect, thanks!

"Vergel Adriano" wrote:

try it this way:

For nCol = 1 To rec6.Fields.Count
Sheets("ACN").Cells(7, nCol+12).Value = rec6.Fields(nCol - 1).Name
Next nCol
Sheets("ACN").Cells(8, 13).CopyFromRecordset rec6


--
Hope that helps.

Vergel Adriano


"Kirk P." wrote:

How do I modify this code to get the Field names from rec6 to start in column
13? They currently start in column 1, and I've tried modifying it several
ways - so far no luck.

For nCol = 1 To rec6.Fields.Count
Sheets("ACN").Cells(7, nCol).Value = rec6.Fields(nCol - 1).Name
Next nCol
Sheets("ACN").Cells(8, 13).CopyFromRecordset rec6

Thanks!