Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Application.Ontime

1,956 views
Skip to first unread message

Seth

unread,
Apr 9, 2003, 9:18:10 PM4/9/03
to
The Ontime method of the Application object receives
a "Procedure" argument. This calls a procedure in a
standard module to be performed. What if this procedure
has parameters? Is it possible to include arguments in
the "Procedure" string, and if so, how?

Thanks so much!

Seth

Chip Pearson

unread,
Apr 9, 2003, 9:32:08 PM4/9/03
to
Seth,

You have to enclose the procedure name and all the arguments within
apostrophe characters. E.g.,

Application.OnTime Now + TimeSerial(0, 0, 2), " 'BBB 11,22 ' "

This will call procedure BBB passing two numeric arguments, 11 and
22. To pass string arguments, you have to enclose the string
arguments in double quotes:

Application.OnTime Now + TimeSerial(0, 0, 2), _
" 'BBB ""text"", ""text2"" ' "

If you want to pass variables, build up the text string that is
passed to OnTime. E.g,

N1 = 11
N2 = 22
Application.OnTime Now + TimeSerial(0, 0, 2), _
" 'BBB " & N1 & "," & N2 & " ' "

Becareful with the quotes and apostrophes -- it is easy to get them
mismatched.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com

"Seth" <sdm...@hotmail.com> wrote in message
news:026201c2feff$0d19deb0$a601...@phx.gbl...

Colo

unread,
Apr 9, 2003, 9:39:47 PM4/9/03
to
Hi Seth,

Yes, it's possible please try like this... :D

Sub Argumenttest()
Const strMsg As String = "How are you doing?"
Application.OnTime Now, "'TestProc" & Chr$(34) & strMsg & Chr$(34) & "'"
End Sub

Sub TestProc(ByVal str As String)
MsgBox str
End Sub

Colo

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Colo - VBA guy! of 'The Road of The Cell Masters'
http://www.interq.or.jp/sun/puremis/colo/CellMastersLink.htm

/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_


"Seth" <sdm...@hotmail.com> wrote in message
news:026201c2feff$0d19deb0$a601...@phx.gbl...

Seth

unread,
Apr 9, 2003, 9:48:58 PM4/9/03
to
Thank you so much for the complete explanation!!!
Extremely useful!

Thanks!!!

Seth

Seth

unread,
Apr 9, 2003, 9:49:30 PM4/9/03
to
Thanks for the example! This information is extremely
useful!

Seth

0 new messages