Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multithread or background execution of code-free up app to continue

Status
Not open for further replies.

gilmore66

MIS
Sep 25, 2003
5
US
I have an applet that I have been working on to send Outlook reminders to my pager via email. What I want to do is have a timer run in the background after a reminder pops up, and when that timer expires, the VBA code will check to see if the reminder is still up. I have the code now to check the reminder to see if its IsVisible property is still true. What I need is a method or way of running the timer in the background while I continue using Outlook. Regular VBA code seems to halt execution of Outlook while it is processing. Is it possible to run VBA code concurrently while the app is being run? Or would I have to create a DLL that would take a timing parameter and an event parameter, start a timer, and when the time expires, raise the event back to Outlook (this is the only solution I can come up with, and it seems extremely tough - I have no idea how to raise an event inside Outlook from a DLL, so this may become the next question I post...).

Thanks.

Gilbert Moore
 
Have you tried using the Application.OnTime? On the couple of project I use this, it doesn't seem to stop any other processes. There are threads on this forum covering the use of the OnTime method. It works sort of like a timer and can call itself.

Charles
Walden's Machine, Inc.
Quality Assurance/Office Developer
 
Actually, the Fyne Folke at Microsoft decided, in their infinate wizdom, not to include the Application.OnTime method in MSOutlook VBA library. Any other suggestions or equivalents?

Application.OnTime would do exactly what I want it to do. Thanks, Mr. Gates.

Appreciate the attempt, though.

Gilbert
 
Hey Gilbert,
Maybe you can get this to work and then let me know the results, I am not that great of a programmer.

I added the excel object library to an outlook project then put this code in there.

Public Sub TestTimerEvent()
Excel.Application.OnTime Now + TimeValue("00:00:15"), "TestCode"
End Sub

Public Sub TestCode()
MsgBox "It Works? No."
End Sub

The timer works in that it goes off in 15 seconds, but for some reason it can't "find" TestCode. Silly Visual Basic! I am sure there is some kind of work around for this, but I am tired and since nobody seems to be able to answer my question in the .net forum on datagrids I have a long night of redesigning an application. Good luck.

Charles
Walden's Machine, Inc.
Quality Assurance/Office Developer
 
I tried doing that, but apparently the method application.ontime doesn't appear to be inside the Excel Object Library. It must be inside something else. Nice, huh?

Gilbert Moore
I'm not an actor, but I play one on TV...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top