Thanks for the explanation but I don't think there's enough information there for me to give you any specific advice, so I'm just going to show you a general process using VBA.
Let's pretend that we have a form with a couple of textboxes where the user will enter the column captions that they want to show up in the Excel file. Also, we are going to pretend that we have a query called "qryExportToExcel" that we are going to export. It doesn't matter what table or fields are in this query because we are going to change it everytime we run our code.
Now, on our form, let's say that we have a command button labeled "Export To Excel" that the user will click to create the Excel file after they enter the column names. Here's the possible code behind that button:
Dim qdf As QueryDef
Dim strSQL As String
Set qdf = CurrentDb.QueryDefs("qryExportToExcel")
strSQL = "SELECT Field1 As " & Me.Textbox1 & ", Field2 As " & Me.Textbox2 & " FROM TableName"
qdf.SQL = strSQL
Set qdf = Nothing
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryExportToExcel","C:\FullPath\To\ExcelFile.xls"
Hope that helps...