I am working on a data acquisition frontend for Excel 2010.
I can't figure out the syntax for passing multiple local variable arguments to Application.OnTime
.
http://markrowlinson.co.uk/articles.php?id=10 provides a good example for a single variable as an argument, but the explanation on how to extrapolate this to multiple variables is not clear to me.
Does anyone have a concise explanation of the correct nesting of "
and '
characters when passing multiple local variable arguments?
Edit: Code example would be like this: Application.OnTime Now + TimeSerial(0, 0, 5), "'runScheduledReport """ & iArg1 & "","" & iArg2 & "" "" & iArg3 & "" ""'"
.
I understand that we're using the double quote as an escape character within the string, but can't really figure out the ordering of the strings being passed.
you have to consider the following constraints:
Find attached the code:
Option Explicit
Sub Test()
Dim strTest1 As String
Dim strTest2 As String
strTest1 = "This is test1"
strTest2 = "This is test2"
Application.OnTime Now + TimeSerial(0, 0, 1), "'CallMeOnTime """ & strTest1 & """,""" & strTest2 & "'"
Application.OnTime Now + TimeSerial(0, 0, 1), "'CallMeOnTime " & Chr$(34) & "Test" & Chr$(34) & "," & Chr$(34) & "Test" & Chr$(34) & "'"
Application.OnTime Now + TimeSerial(0, 0, 1), "'CallMeOnTime2'"
End Sub
Public Sub CallMeOnTime(strTest1 As String, strTest2 As String)
MsgBox ("test1: " & strTest1 & " test2:" & strTest2)
End Sub
Public Sub CallMeOnTime2()
MsgBox ("CallMeOnTime2")
End Sub