473,478 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Runcode recieving error 2425

20 New Member
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
  3.  
  4.     Set MyXL = CreateObject("Excel.Application")
  5.     With MyXL
  6.     .Application.Visible = True
  7.     .Workbooks.Open "S:\DateCodes.xlxs"
  8.     End With
  9.  
  10. End Function
Aug 26 '19 #1
4 6111
NeoPa
32,556 Recognized Expert Moderator MVP
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.
Aug 26 '19 #2
CharlesDelou
1 New Member
I have same issue, good hint what do you mean by standard
module. Cant see why my module wouldn t be standard.
Thanks
May 4 '20 #3
NeoPa
32,556 Recognized Expert Moderator MVP
I don't generally respond at all where third parties put addenda into threads but I will do so for this one as a strictly one-off exception (IE. If you need further help you will need to post in a separate thread or see your posts removed). Your question could prove generally helpful.

In the VBIDE (Visual Basic Integrated Development Environment) you can generally see the Project Explorer which allows you to see the Objects (Forms & Reports), the Class Modules & the Standard Modules. If you right-click and select Insert then Module it will create a new Standard Module for you.

There are essentially three types of module :
  1. Those associated with Objects (Forms or Reports).
  2. Class Modules.
  3. Standard Modules.
Only #3 (Standard Module) procedures, variables and constants can be referenced from anywhere in the project without qualification. The others are all Class Modules of one type or another and require qualification in any reference either from the Class or the Instance.
May 5 '20 #4
ADezii
8,834 Recognized Expert Expert
In the Function Name Argument of your Macro, be sure to include the opening and closing parenthesis, as in:
Expand|Select|Wrap|Line Numbers
  1. OpenExcelFromAccess()
May 5 '20 #5

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

Similar topics

7
9426
by: Tom Chidwick | last post by:
Hello, I've custom-built a fairly extensive object model that is designed to run in the background and control the opening and closing of related forms. The whole thing kicks-off with an...
4
11318
by: Abdhul Saleem | last post by:
Hi, I am recieving error ActiveX component can't create object in the following line in the asp page. set ExcelApp = CreateObject("Excel.Application") Previously this code was working fine....
5
10787
by: Nathan Sokalski | last post by:
I have an ASP.NET application which is giving the following JavaScript error: 'theForm' is undefined However, when I do a View Source one of the <scriptelements is as follows: <script...
6
3035
by: Nathan Sokalski | last post by:
I have an ASP.NET application which is giving the following JavaScript error: 'theForm' is undefined However, when I did a View Source I noticed that ASP.NET added the following code: ...
7
1480
by: rivers1 | last post by:
I'm not a tech by any stretch of the imagination but I'm hoping you guys can help. I'm recieving the object expected error on a host of sites but one in particular is bugging me, I know the site...
3
2157
daniel aristidou
by: daniel aristidou | last post by:
Hi i just finished a program and installed it on the client pc....when i start it up im recieving error messages Does anybody understand these and can anybody suggest a solution? ...
3
2948
by: Tom van Stiphout | last post by:
On Thu, 30 Oct 2008 11:04:44 GMT, "JOHNNY OUTING" <outingjr@att.net> wrote: You managed to violate several netiquette rules in one post. Please review http://www.mvps.org/access/netiquette.htm...
4
4693
by: autiger13 | last post by:
Hi I am working on a program that will connect to a server that I input from the command line and make a request for the HTTP response. I am currently using www.yahoo.com as a test site for my...
2
3334
by: Otis Monroe | last post by:
#include <iostream> #include <iomanip> #include <string> using namespace std; int main() { //declare variables string name = " ";
3
4811
by: Neal Rodruck | last post by:
Hello, I am taking my first quarter of programming and am having a VERY difficult time understanding jagged arrays. At the moment I am working on a project that is using two two dimensional...
0
7027
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,...
0
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7019
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6847
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...
1
4757
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
4463
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
2980
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
1288
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.