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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
one sugg ..... u can use "call"

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

Sub tempPro ()
call MyProcedure (2)
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,826
Members
449,051
Latest member
excelquestion515

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
Back
Top