Tuesday, 21 April 2015

How to Run VBA Macro Code with a Microsoft Access Macro

 Running VBA Macro Code with a Microsoft Access Macro Functionality

Suppose we have a Macro Code , developed in MS-Access to fulfill some task as follows :

Sub Exp_Query_Data2Excel()
'Code Stuff here
End Sub

Now I want Run this Macro by assigning it to Quick Access Toolbar / Though Access Macro event.

But , In MS-Access , We cannot assign the VBA Macros to the Quick Access Tool bar. 

So that we can only run the Macro through Access Macro event as follows ;

First  define a Function in the VBA Macro Module and Call the above Macro into that Function as follows :

Function Exp_Query_Data()
Call Exp_Query_Data2Excel
End Function



Next , create Access Macro and define a RunCode event  then we have to Pass the Function Name , in the RunCode event as shown below : 



Now ,we can Run the VBA Code Macro "Exp_Query_Data2Excel()" with Access Macro "Run_A_Macro".

Thanks,
TAMATAM

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts