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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

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
Back
Top