Stan Graziano said:
Very interesting. Can you suggest a process by which I can test this?
Open the MDB and look? The database window has a list of categories of
objects (tables, queries, forms, reports, pages, macros, modules) down the
left hand side. If 'JanMacro' is a macro, it will be listed under 'macros'.
If it is a VBA procedure, it will be contained in one of the modules listed
under 'modules'. If there are many modules, rather than hunting through them
one at a time, open any one of them and use the Find dialog (on the Edit
menu) to search the current project for 'JanMacro'.
I
don't know how to create a VBA procedure in Excel.
In Excel, 'macro' and 'VBA procedure' are synonyms. Recording a macro
creates a VBA procedure. But you can also create a procedure without
recording, by selecting Macro, then VBA Editor, from the Tools menu.
If you are right, how do
I call the macro? Could I create a VBA procedure that calls the macro?
Sure. The VBA code is: DoCmd.RunMacro "YourMacroNameHere"
The code you posted appears to be server-side code? You do realize the
instance of Access that is created will be created on the server?
--
Brendan Reynolds (MVP)
:
This is just a guess on my part, but I note that the message says that
Access can't find "the procedure" rather than "the macro". Is your
automation code perhaps attempting to run a VBA procedure, rather than a
macro? (In case you didn't already know this, while the term 'macro' is
often used to refer to a VBA procedure in other Office applications, such
as
Word and Excel, in Access macros are separate and very different objects
from VBA procedures).
--
Brendan Reynolds (MVP)
Here is the exception I got:
[COMException (0x800a09d5): Microsoft Access can't find the procedure
'JanMacro.']
Here is the code that caused it:
......
Access.ApplicationClass oAccess = new Access.ApplicationClass();
oAccess.Visible = true;
oAccess.OpenCurrentDatabase(path, false, "");
// Run the macros.
RunMacro(oAccess, new Object[]{"JanMacro"});
.....
private void RunMacro(object oApp, object[] oRunArgs)
{
oApp.GetType().InvokeMember("Run",
System.Reflection.BindingFlags.Default |
System.Reflection.BindingFlags.InvokeMethod,
null, oApp, oRunArgs);
}
:
I would like to run an Access Module in ASP.NET. I am using
automation,
and
I can access the data in the database, but when I try to run a macro
(using
the late binding method), I get an exception that Access could not
find
the
macro I specified. My macro name is "JanList" but in the error
message
Access said that it could not find "JanList. " Does the addition of a
period
and space in the macro name string inidicate something about what I'm
doing
wrong? Do I need to put some delimiter or something around the macro
name?
Thanks in advance.
Stan