Calling an Excel based VBA code from within Access

access enquiries

New Member
Joined
Sep 7, 2006
Messages
5
Hi all,

I have an excel spreadsheet that contains a VBA module that manipulates the contents of the spreadsheet and outputs it to external files. I want to trigger the excel module from within an existing Access database by the user clicking a button on a form (the access application performs many functions beyond this particular requirement so an excel based interface is not ideal).

I know that you can somehow use an access based VBA module to open a spreadsheet , and by setting the macro to execute on opening the file the process could be run. This is not ideal but would work, any ideas on how to open the excel file from within the access module.

A better alternative would be to open the excel file and to directly call the excel based module, anyone know how to do this.

I would also like to have the entire excel process happen in the background without the screen being updated, anyone know how to ensure that excel is never visible and that both the excel file and the excel application are closed after the excel module has run.

Thanks a lot for you support.



with an auto exec macro
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Hi, and welcome to the Board!

This link has a number of examples for running code in another application.

You would need to:
1. Create the code in Access, and test it
2. Create an autoexec macro in Access that runs the code. There should be a RunCode macro step that you can use.

Denis
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,071
Messages
5,857,177
Members
431,860
Latest member
Roofing Contractors

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top