View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Calling Private Sub/Function

Hi AMK4,

In fact, if no parameters are to be passed, the private macro or function
can be called without recourse to the Run method:

Sub AAA()
Application.OnTime Now + TimeValue("00:00:05"),"MyMacro"
End Sub

Or, if the macro is in another workbook:

Sub AAAA()
Application.OnTime Now + TimeValue("00:00:05"), _
"'Another Workbook'!MyMacro"
End Sub

Or, if the macro is in a sheet module of another workbook:

Sub AAAAA()
Application.OnTime Now + TimeValue("00:00:05"), _
"'Another Workbook'!Sheet1.MyMacro"
End Sub


---
Regards,
Norman


"AMK4" wrote in message
...

Norman Jones Wrote:
Hi AMK4

Look at the Run method in VBA help.


I'm a bit confused. How would I use this in an OnTime method?

This is what I'm trying to get to:

My userForm has this on it:
Application.OnTime Now + TimeValue("00:00:05"), "myMacro"

myMacro is a Private Sub defined in the Modules. How would I use
Application.Run instead of calling myMacro?


--
AMK4
------------------------------------------------------------------------
AMK4's Profile:
http://www.excelforum.com/member.php...o&userid=19143
View this thread: http://www.excelforum.com/showthread...hreadid=508329