Bring in column title with query in VBA like Excel's query wizard

WHen using Excel's quiery wizard, it brings in the column titles, but is there a way to set a VBA SQL statement to do the same?  That is, rather than having to name the feilds with code in VBA, can the SQL statement be set to bring the column headers in as well?
With Workbooks(strWbkName).Worksheets("DataSource") 'Current month's Green Package destination workbook
    strSQL = "SELECT [ClientCode] , [Fund/Sector],[%NotionalScaling], [%NotionalBench], " & _
          "[SpreadDurationContributionPort], [SpreadDurationContributionBench] " & _
          "FROM " & strRangeName & " "
    Set rst = New ADODB.Recordset
     Call rst.Open(strSQL, strCnn, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly, CommandTypeEnum.adCmdText)
            strLastRow = .Range(strDestination & "65536").End(xlUp).Address
            intRowNum = (.Range(strLastRow).Row) + 1
     Call .Range(strDestination & intRowNum).CopyFromRecordset(rst)  'Need to dynamcially determin last cell
End With

Open in new window

Sandra SmithRetiredAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dlmilleCommented:
Select Column_Name from table should return all column names.

Dave
0
dlmilleCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sandra SmithRetiredAuthor Commented:
Thanks Dave.

Sandra
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.