Hello,
I apologize if this is a dumb question as all this is new to me.
All I'm wanting to do is have Microsoft Access export a query to Microsoft Excel with the columns autofit for width. I have seen that it can be done, but I'm far from understanding everything just yet. I've created a test database for myself and so far have the following code:
Code:
Private Sub Export_Selected_Data_to_Excel_Button_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Export Selected Query", Environ("USERPROFILE") & "\Desktop\ExportedData.xlsx", True
End Sub
I know it is simple as I am very new to Microsoft Access and coding/VBA at all. Right now I am happy as I have learned to export the query from my table to my desktop and it looks great so far.
I would love to have the columns autofit to width, and also if it is possible I would love to have the top row frozen? I know that's asking a lot! I'm hoping someone can help!
Thank you so much for your time!