I have this code to export a 4 column table to excel:
Public Function Exportar()
Dim ruta As String
ruta = "C:\Users\Desktop\FICHERO.xlsx"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tabla1", ruta, True
End Function
Sub ejecu()
End Sub
Once exported, you open the file and everything is correct, but I would like to give the table header a different color to differentiate it from the rest of the data.
I don't know if the color can be added from the code.
I think you can with.Interior.Color
I've been trying several things, but nothing.
I leave you an example so that you understand what it is to handle the Excel object. It is simple precisely so that it is easy to understand, and you can improve it and/or adapt it to your needs. Obviously you can use other properties.
Cheers
I think the error comes from the references I have, they are these