473,466 Members | 4,879 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Execute a macro from VBA code


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.

Dec 3 '07 #1
5 28326
Hi,
So what is the correct syntax to call a macro from VBA code ?
Try : DoCmd.RunMacro (Macroname)

Regards
Jens
Dec 3 '07 #2
On 3 déc, 11:46, "Jens Schilling"
<jensschillingBitteLoesc...@fissership.dewrote:
Hi,
So what is the correct syntax to call a macro from VBA code ?

Try : DoCmd.RunMacro (Macroname)

Regards
Jens
Thank you !

DoCmd.RunMacro ("AutoExec")

runs perfectly.
Dec 3 '07 #3
...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...
Dec 4 '07 #4
On Dec 4, 3:24 pm, King Ron <KingRonPoindex...@covad.netwrote:
..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...
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?
Dec 4 '07 #5
On Dec 3, 5:32 am, nartla <bruno.bar...@altran.comwrote:
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.
and you also realize that the 'AutoExec' marco gets automatically run
when you run/open your application.
bobh
Dec 4 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
7
by: SueB | last post by:
Hi. I want to execute a routine, at database startup time, to relink the backend tables. I have the code for the function, but I don't know where to invoke it. I tried putting a call to the...
3
by: Alexander Ulyanov | last post by:
Hi all. Is it possible to pass the whole blocks of code (possibly including " and ,) as macro parameters? I want to do something like: MACRO(FOO, "Foo", "return "Foobar";", "foo();...
0
by: ismailc | last post by:
hi, i need help please! i have a macro within an excel file(c:\test.xls) called macro1, how do i get it to execute? xl_app.run macro1 (the area of concern, this does not work) ...
0
by: hartliec | last post by:
I would like to execute a Access 2002 Macro (TransferText) using ASP. Any ideas? This is what I have so far.. Page 1 *****accessmacro.asp************ <html><body> <% strDbName = 'Put...
7
by: vincent90152900 | last post by:
Is it possible to use a word macro to execute an .exe file? How to do that? This is discussion is open to suggestions. Many thanks for your replying.
2
by: ccogan | last post by:
After installing Visual Studio Express at home out of curiosity, macro execution in Visual Studio 2005 Professional has been disabled. Uninstalling Visual Studio Express didn't help. Re-installing...
2
by: femtox77 | last post by:
Hi to all! Do you know if i can execute a macro at exit of a program? If yes, how can i do it? Thank to all Femtox
0
by: =?Utf-8?B?a2th?= | last post by:
I have a C#.NET program where I have opened an excel spreadsheet with a macro. I want to execute that macro to create a chart programatically. When I try to use run it gives an error. How can I...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.