Full Version: Set Excel Column Width From Access When Exporting
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
spooker
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.

Terry
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.
spooker
Thanks Doug, I'll take a look.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.