PDA

View Full Version : Automating Access - Excel Exporting



Incognitus
10-17-2011, 11:50 AM
Hello,

Basically, I'm running a query to bring up records from a table, creating a new table from them which is named "Project/Query Name Now()" and then exported to Excel. Once the Excel file is exported, then all the selected records are erased, and the folder in which the file is stored is opened whilst Access adds the file to a new email and dispatches it.

That's the part I can do - or at least, assume I can do with no issues based on prior Acces experience!

1.) I have particular records which need to be highlighted in Excel based on the value of a particular field. How do I go about doing this?

2.) Also, I know it is possible to change the colours of the datasheet view in Access, but is it possible to change the field names into company colours when exported into Excel - so far all my attempts have fallen flat. :(

Any help would be greatly appreciated!

HiTechCoach
10-18-2011, 08:48 AM
I normally handle this with Excel Automation. This allows me to add any formatting to the cells in the Excel spreadsheet as needed.

At times I have also created an Excel template that had the cell formatting already applied. I use this template to create a new workbook as the starting point for exporting with Excel automation.

Here is where I got my start with Excel Automation: Export Data To Excel (http://www.hitechcoach.com/index.php?view=weblink&catid=84%3Aaccess-vba-office-automation&id=301%3Aexport-data-to-excel&option=com_weblinks&Itemid=23)