Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / December 2007

Tip: Looking for answers? Try searching our database.

Execute a macro from VBA code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nartla - 03 Dec 2007 10:32 GMT
Hello,

I am working an an app developped in VBA/Access, and I would like to
call a macro (named AutoExec) directly from the VBA code of my
program.

I tried the following :

Call AutoExec

in then VBA code, but when compiling, I get an error saying that "Sub
is not defined".

So what is the correct syntax to call a macro from VBA code ?

Thank you for your help.
Jens Schilling - 03 Dec 2007 10:46 GMT
Hi,

> So what is the correct syntax to call a macro from VBA code ?

Try :  DoCmd.RunMacro (Macroname)

Regards
Jens
nartla - 03 Dec 2007 10:55 GMT
On 3 déc, 11:46, "Jens Schilling"
<jensschillingBitteLoesc...@fissership.de> wrote:
> Hi,
>
[quoted text clipped - 4 lines]
> Regards
> Jens

Thank you !

DoCmd.RunMacro ("AutoExec")

runs perfectly.
King Ron - 04 Dec 2007 20:24 GMT
..also, you should note that anything that you can do in a Macro you
can do using VBA code...you might want to consider rewriting your
Macro functions in code...

One of the plusses of coding in VBA is that you can hide all of your
DBA-like functions from the steenking users so they can't drive your
app into a tree as easily...

Ron, King of Chi...
lyle - 04 Dec 2007 20:59 GMT
> ..also, you should note that anything that you can do in a Macro you
> can do using VBA code...you might want to consider rewriting your
[quoted text clipped - 5 lines]
>
> Ron, King of Chi...

I have some users but none of them seems to steenk. (A few smell purty
sweet but in these days of political correctness I pretend not to
notice.) They all seem to want my applications to work properly and
help them accomplish things. What am I doing wrong?
bobh - 04 Dec 2007 21:26 GMT
> Hello,
>
[quoted text clipped - 12 lines]
>
> Thank you for your help.

and you also realize that the 'AutoExec' marco gets automatically run
when you run/open your application.
bobh
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.