Application OnTime event

Posted on 2001-08-09
Medium Priority
Last Modified: 2007-11-27
Is the Application.OnTime event valid in Visual Basic? Or could be used only in VBA? I get the error message 'Macro "my_procedure" not found.' Even if I put the "my_procedure" in a different module, the error message is the same. Any solutions to this?
Question by:octi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6367206
When you put "my_procedure" in a different module you
must reference the module name of the different module:
"my_procedure" in a different module:

Application.OnTime Now + TimeValue("00:00:15"), "ModuleName.meine_Prozedur"

Best Regards

Accepted Solution

kdg2000 earned 400 total points
ID: 6367207
In VB exists Timer Control. It fulfils the defined operations designated in Timer Evet through given time(milliseconds).


At first it is necessary to place(install) time of operation, for example 10 milliseconds

me. Timer1. Interval=10

Further to start by its command

me. Timer1. Enabled=True

Through 10 milliseconds will be fulfilled Event Timer.
LVL 10

Expert Comment

by:Nitin Sontakke
ID: 6367209
Application is a generic object name, so its context changes according to its instantiation. Unless you are using automation, such an object doesn't exist in VB, forget the event.

So, make sure that Application object has appropriate context. You didn't mention from which Application did you imported the Macro.

If i am not clear, please give more info as what you are attempting to do. So that i will be able to tell more details.

But in short, Application.OnTime event is NOT in VB. It MIGHT be used, provided an appropriate context to Application object is available in VB.

Please give more details, though.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 6367230
I would like to run a procedure in Visual Basic (The result will be an exe file) at a certain time (8:00 AM for ex) using the Application objects OnTime event. This is the simplest one. The event occurs (becasuse I get the mentioned messege right on scheduled time) at the given time, but the procedure is not found.

Expert Comment

ID: 6367278
Your procedure is defined in your VB exe project ?

Author Comment

ID: 6367305
Yes, my procedure is defined in the exe project.

Expert Comment

ID: 6367324
In your VB exe Project you have an handle to the VBA
application and then you call:

Application.ontime ....

Then VBA finds only VBA side defined macro procedures.
Not the functions defined in VB.


LVL 16

Expert Comment

ID: 6369104
I agree with WolfgangKoenig.
If you want to run code from VB (Not vba) at certain time, use, inside VB, a timer control or api's SetTimer and KillTimer.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question