By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,818 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,818 IT Pros & Developers. It's quick & easy.

Runcode recieving error 2425

P: 20
In MS Access 2010,I am trying to write some code to a module that I can then use RunCode to run from an AutoExec macro. I have written the code that I think should go in the module and get no errors when I debug/compile it. But when I try to use Runcode and run the macro I get error message 2425 which states "the expression you entered has a function name the Microsoft Access can't find." I checked to make sure that the name of the function called by RunCode was correct. So now, I can't tell what the problem is. Here is my code:
Expand|Select|Wrap|Line Numbers
  1. Function OpenExcelFromAccess()
  2.     Dim MyXL As Object
  4.     Set MyXL = CreateObject("Excel.Application")
  5.     With MyXL
  6.     .Application.Visible = True
  7.     .Workbooks.Open "S:\DateCodes.xlxs"
  8.     End With
  10. End Function
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,470
Is it in a Standard module?
If not then either move it to one or qualify any references to it explicitly.

Is it defined as Public?
Clearly not in your code. Does it default to Public if not specified? Is it visible as an option from the user interface Run Macro box (Database Tools | Run Macro)? If not then it isn't available and that is very likely because it's either not Public or not in a Standard Module.
3 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.