View Full Version : Report export to excel - can you retain formatting?


bc9999
02-03-2008, 12:39 AM
I have a report which is built from a query & then is exported to excel on click event. A basic example of the code is shown below:

DoCmd.OutputTo acOutputReport, "RptMain3", "Microsoft Excel (*.xls)", "C:\test.xls", True

What I was wondering was whether it would be possible to import any of formatting of the report to excel rather than just the fields. I am presuming this isnt possible & would require extra VBA code?


Regards

Helen

boblarson
02-03-2008, 12:45 AM
Unfortunately it will require extra code.

bc9999
02-03-2008, 01:16 AM
Ok, bob thought that would be the case.

As I am new to access the users will have to be happy to do their own formatting on the excel sheet once they have exported :)

Thanks for the reply anyway.

Regards

Helen

boblarson
02-03-2008, 11:46 AM
Helen:

Start working on getting to know the Excel COM object model and it becomes a breeze to do formatting and all via code. It actually isn't all that hard and you can even use the Excel Macro Recorder to generate the base code that you can take and modify to suit.