Summary


At the end of the day, the key to getting the syntax correct , and to understanding it , is as follows: You must arrange it such that what VBA "has", ( which you can check via a Debug.Print of the string you are giving ) needs to have a similar form to how you might manually write in arguments in a code line to call a sub routine taking in arguments. You can add a few extra spaces between multiple arguments and the separating comer , just as you might do carelessly when typing in manually a series of arguments. Presumably, VBA later, when it uses exactly your given string, it does something similar to what happens when you physically write or paste such things in, the result of which is that those extra spaces get removed.

The point of the enclosing ' ' is to indicate to VBA to take literally exactly as you have written it. In my explicit code lines we need that for both the LHS and the RHS. More typically the LHS is omitted.

Any use of a complicated combination of many double or triple " pairs is more of a trick to give you a way to effectively use variables that are within the scheduling macro , in the scheduling Application.OnTime code line. If your variables are in a code module outside of any sub routine, then the variable syntax is much simplified. In this case you do not actually need any quotes within the main string, not even if the a variable type is string. ( The complete second argument of the Application.OnTime always needs to be enclosed in a quote pair )


Alan


Ref
https://groups.google.com/forum/?hl=...o/4rf3VBejtU0J
https://www.mrexcel.com/board/thread...24/#post398494
http://markrowlinson.co.uk/articles.php?id=10
http://www.tushar-mehta.com/publish_...n_method.shtml

P.S.
@ Holger Leichsenring - Hi . I think the apostrophes must enclose the macro name AND the arguments. Any number types can be passed without quotes. The macro you want to call can reside in any module, in any workbook, (open or closed) , and need not be Public. ( My geuss is that `Application.OnTime` uses the same wiring as `Application.Run` , which has the advantage, over simple Calling a sub , that it will run both Public and Private subs ( https://stackoverflow.com/questions/...09370#59809370 ) )

Gruß, Alan