Excel OnTime

  • Thread starter Thread starter Bodo v. Ulmenstein
  • Start date Start date
B

Bodo v. Ulmenstein

Hi,

I've add a reference to Microsoft Excel object library to execute
Application.Ontime method
in my Outlook project.
The OnTime method requires to specify a procedure name.

How do I reference a public sub declared in my Outlook project?

The code below fails to exceute since Excel.OnTime can't resolve "mySub"
So I need to specify the full reference path to my Outlook procect.
How do I do that?

Example:

' Outlook sub
Public Sub Timer
Dim xls As Excel.Application

Set xls = CreateObject("Excel.Application")

xls.OnTime DateAdd("n", 5, Now), "mySub", , True
End Sub


Public Sub mySub

End sub


Many thanks
Bodo
 
You can't run VBA procedures within an Office application from another
Office app. You'll have to automate them from one location only, whether
it's VBA code or COM Add-Ins.
 
Back
Top