LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default OnTime: Pass Object Arguments

Just to confirm, you can only pass strings (incl numbers) as arguments to a
routine called with the OnTime method. In addition to Dave's suggestion you
could also pass one or more string arguments such that you can recreate the
object, eg

set rng = Workbooks(sArg1).Worksheets(sArg2).Range(sArg3)

or

set rng = range(sFullAddress)
where sFullAddress = "'[Book1]Sheet1'!A1"
there's a pair of apostrophes in that, and would need to be less than 255

Regards,
Peter T


"Greg Lovern" wrote in message
ups.com...
I understand how to pass number and string arguments with OnTime. But
what about object arguments? Can I pass a range object, combobox
object, etc.?


Here's how I'm passing number and string arguments. How do I pass
object arguments?


Function tester1()
Const NUM_ARG As Long = 5
Const STRING_ARG As String = "String"

Debug.Print "tester1: " & NUM_ARG & ", " & STRING_ARG & ", " & Now
Application.OnTime Now + 0.0000001, "'tester2 " & NUM_ARG & ", """
& STRING_ARG & """'"
End Function


Function tester2(NUM_ARG, STRING_ARG)
Debug.Print "tester2: " & NUM_ARG & ", " & STRING_ARG & ", " & Now
Debug.Print
End Function


Thanks,

Greg



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass variables as arguments of a function Excel-craze Excel Worksheet Functions 1 August 12th 09 11:48 AM
How to pass arguments to vlookup in VBA mathewg Excel Programming 4 January 20th 06 12:34 PM
Application.OnTime -- Unable to Pass Macro with Numeric Parameter Butaambala Excel Programming 7 June 7th 05 10:55 PM
Run/execute VBS and pass arguments Claud Balls Excel Programming 3 February 4th 05 08:34 AM
How to pass arguments from ThisWorkbook to a UserForm strataguru[_4_] Excel Programming 1 October 7th 03 11:29 PM


All times are GMT +1. The time now is 06:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"