Full Version: Set Excel Column Width From Access When Exporting
UtterAccess Forums > Microsoft® Access > Access Automation
Is there a way to set the width of Excel columns when exporting from Access?
I have VBA code to export the data to excel which works OK, but the excel file does not adjust the column to the size of the text within the fields and I have to manually adjust the columns in excel each time the data is exported.
Is there a way to do this using VBA at the time of exporting the data?
I'm using Access 2003.
Thanks in advance.
Doug Steele
You'd have to use Automation to instantiate an instance of Excel and format it once you've exported the spreadsheet.
See my July, 2005 Access Answers column in Pinnacle Publication's "Smart Access" (Excelling Automatically) for an example.
Thanks Doug, I'll take a look.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.