Jim Moss
jim.moss at jlmoss.net
Wed May 25 16:38:28 CDT 2005
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 >