OnTime method: Setting arguments in called procedures

jc113883

Board Regular
Joined
May 29, 2006
Messages
165
Hi all,

You can use the OnTime macro to run procedures at certain times:

Code:
 Application.OnTime "07:30", "MyProcedure"

But how do I set the arguments that MyProcedure requires to run?

For example, I have a procedure:
Code:
 Sub MyProcedure (Arg1)
 a = Arg1
 End Sub

Lets say I want Arg1 = 2. The following do not work:
Code:
Application.OnTime "07:30", "MyProcedure(2)"     '(Can't find 'MyProcedure(2)'
Application.OnTime "07:30", "MyProcedure" (2)      'Syntax Error

So does anyone know what does?!

Cheers,
Graeme.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

hsk

Well-known Member
Joined
Oct 19, 2006
Messages
567
one sugg ..... u can use "call"

Application.OnTime "07:30", "tempPro"

Sub tempPro ()
call MyProcedure (2)
End Sub
 

Forum statistics

Threads
1,181,100
Messages
5,928,058
Members
436,586
Latest member
latintxn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top