Hale, Jim
Jim.Hale at FleetPride.com
Wed May 25 17:05:28 CDT 2005
I also make extensive use of Excel templates that I call from Access, populate and save as regular .xls files. This allows you to extensively format a workbook ahead of time and use it over and over just adding different data. Jim Hale -----Original Message----- From: Jim Moss [mailto:jim.moss at jlmoss.net] Sent: Wednesday, May 25, 2005 4:38 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Excel Macro Automation from within Access Mark, You can output the formatted Excel file from Access and let Excel write the formatting VBA for you. Start Excel and turn on macro recording, then format the sheet your way. When finished stop recording and save. Open the macros menu item, copy the code from your macro, and paste into an Access module. Open your query as a recordset and loop through the rows setting your excel field to the rs field. I'll email an example to you if you like. Jim > I have a need to run Excel macro code from within Access VBA. > Basically, the code logic flows as follows: > 1. Export Access report as a new Excel file (DoCmd.OutputTo > acOutputReport, strXLName, acFormatXLS, , True) > 2. Run Excel macro (from within Access VBA) to format the Excel file > accordingly. > > Does anyone have any sample code and/or resources related to this logic? > Any help is greatly appreciated. > > Thanks, > Mark Boyd > I/S Supervisor > McBee Associates, Inc. > > ----------------------------------------- > This message and any attachments are intended only for the use of the > individual or entity to which it is addressed and may contain information > that is privileged, confidential, and exempt from disclosure under > applicable law. If the reader of this message is not the intended > recipient, or the employee or agent responsible for delivering the message > to the intended recipient, you are hereby notified that any dissemination, > distribution or copying of this communication is strictly prohibited. If > you have received this communication in error, please notify the sender by > replying to this message, and then delete it from your system. > ------------------------------------------- > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email.