Connecting Tech Pros Worldwide Forums | Help | Site Map

help with DoCmd.RunMacro

7 of 9's Avatar
Newbie
 
Join Date: May 2007
Posts: 23
#1: Jul 12 '07
I am creating a Module in access to export the results of a query to excel and once there run a macro that i have created. the problem is that this is the first time that I have done this and I am not sure how.

when I begin to write the code access tellls me to put it in the following format:

DoCmd.RunMacro (MacroName,[RepeatCount],[RepeatExpression])


but when i do ittells me,

compile error expected =

what is the correct syntax

Thanks

JConsulting's Avatar
Expert
 
Join Date: Apr 2007
Location: Houston
Posts: 601
#2: Jul 12 '07

re: help with DoCmd.RunMacro


Quote:

Originally Posted by 7 of 9

I am creating a Module in access to export the results of a query to excel and once there run a macro that i have created. the problem is that this is the first time that I have done this and I am not sure how.

when I begin to write the code access tellls me to put it in the following format:

DoCmd.RunMacro (MacroName,[RepeatCount],[RepeatExpression])


but when i do ittells me,

compile error expected =

what is the correct syntax

Thanks

IT can be a bit confusing, especially without examples.
Expand|Select|Wrap|Line Numbers
  1. doCmd.runMacro "yourmacroname"
  2.  
that's all you need. The repeat count applies if you want to run the macro more than once and the repeat expression is an option that lets you run just one expression in your macro multiple times. You don't have to include those to run your macro.
J
7 of 9's Avatar
Newbie
 
Join Date: May 2007
Posts: 23
#3: Jul 12 '07

re: help with DoCmd.RunMacro


Quote:

Originally Posted by JConsulting

IT can be a bit confusing, especially without examples.

Expand|Select|Wrap|Line Numbers
  1. doCmd.runMacro "yourmacroname"
  2.  
that's all you need. The repeat count applies if you want to run the macro more than once and the repeat expression is an option that lets you run just one expression in your macro multiple times. You don't have to include those to run your macro.
J

It workes! -Thanks J.
Reply