Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Run VB Code via macro

So I am creating a menu (customizing toolbars) in Access 2003 and I want to create a menu command to run a few lines of VB Code. Is there a way to do this in Access 2003? For example, create a module with the VB coding then create a macro that will run the module?

Thanks,
Dan
0
filtrationproducts
Asked:
filtrationproducts
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
the VB code that you need to run must be placed in a function in a regular module.

in the Action of your macro, you will place

RunCode


Function Name   myFunction()
0
 
filtrationproductsAuthor Commented:
I created a new module called newcpar and put the code in it. I then created a new macro and used RunCode with myFunction(newcpar) but it is not working.

Am I going about this right?

Dan
0
 
filtrationproductsAuthor Commented:
I didn't know I had to give it a function name inside the module. It works now.
0
 
Rey Obrero (Capricorn1)Commented:
<Am I going about this right?> gues Not

what is the name of the function that you placed in the module "newcpar" ?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now