Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() So how can you call a Private Sub or Function? Or is that simply not possible? I have an OnTime event that needs to call another Sub when the timer runs out, but that other Sub is private. -- AMK4 ------------------------------------------------------------------------ AMK4's Profile: http://www.excelforum.com/member.php...o&userid=19143 View this thread: http://www.excelforum.com/showthread...hreadid=508329 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AMK4
Look at the Run method in VBA help. --- Regards, Norman "AMK4" wrote in message ... So how can you call a Private Sub or Function? Or is that simply not possible? I have an OnTime event that needs to call another Sub when the timer runs out, but that other Sub is private. -- AMK4 ------------------------------------------------------------------------ AMK4's Profile: http://www.excelforum.com/member.php...o&userid=19143 View this thread: http://www.excelforum.com/showthread...hreadid=508329 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AMK4,
One way: Sub AAA() Application.OnTime Now + TimeValue("00:00:05"), "myMacro" End Sub Sub myMacro() Call BBB End Sub Private Sub BBB() MsgBox "Hello" 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi AMK4,
And, if parameters are to be passed to the function or macro, then try something like: Sub ABC() Application.OnTime Now + TimeValue("00:00:05"), "BBB" End Sub Sub BBB() MsgBox Application.Run("MyFunction", 2, 3) End Sub Private Function MyFunction(var1, var2) MyFunction = var1 * var2 End Function --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
difference between a private sub and a public function? | Excel Discussion (Misc queries) | |||
private variable: same module, other Sub/Function | Excel Programming | |||
Calling a Private Sub | Excel Programming | |||
Calling a private sub | Excel Programming | |||
calling private subs | Excel Programming |