I'm assuming that you wish to run a macro, not a module. If so then do this...
1) RightClick the button and select "View Code". A CommandButton<Number>_Click event will be added to the forms code window.
2) Add the name of the macro into the event.
3) Run the form and click the button. The macro will run.
An event is a sub routine that responds to a user action like clicking a button or pressing a keyboard key etc, or a system action like a change of data in a sheet or the updating of a value in a control.
A module is just a container for your macros that are not events routines (which are related to a form or sheet in Excels' case) and are also available to the entire project. If you wish to run all the macros in a module you would spacify each by name.
Shouldn't you substitute the word 'Function' for 'Macro'?
Modification of Anvil19's post.
In Access2K - right click the button (Form View is fine) - select Properties
Go to the Event Tab
Click into the Row labeled 'On Click' and hit the three dots off to the right
To call specific Functions in the module you wrote:
Call functionname()
Add arguments within the () if needed for the function.
Identical Syntax for Subroutines
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.