[AccessD] Excel Macro Automation from within Access

Mark Boyd MarkBoyd at McBeeAssociates.com
Wed May 25 16:55:08 CDT 2005


Thanks Jim.
I actually have the VBA from the Excel macro already created.  I would
definitely appreciate any code reference you have to offer that will run
the macro from within the Access code.  

Thanks again,
Mark Boyd
I/S Supervisor
McBee Associates, Inc.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Moss
Sent: Wednesday, May 25, 2005 5: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
 
-----------------------------------------
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.
-------------------------------------------



More information about the AccessD mailing list