当被调用的过程具有参数时,如何在Application.onTime函数上调用过程?
Sub popUpReminder(msg As String)
MsgBox (msg)
End Sub
Sub schedulePopUp()
Application.OnTime Now + TimeValue("00:00:05"), "popUpReminder " & """" & "Hello" & """"
End Sub
答案 0 :(得分:1)
我讨厌这样说,但您甚至需要 more 引号:-)但是,实际上并不需要将内部引号分成单独的字符串,您可以使用:
Application.OnTime Now + TimeValue("00:00:05"), "'popUpReminder ""Hello""'"
也许更可见的示例是采用单个整数的函数。那应该是:
Application.OnTime Now + TimeValue("00:00:05"), "'checkAnswer 42'"
您可以在其中看到整个语句都被引用。
答案 1 :(得分:1)
您需要在两边都加一个单引号,并稍加重新格式化:
Sub popUpReminder(msg As String)
MsgBox (msg)
End Sub
Sub schedulePopUp()
Application.OnTime Now + TimeValue("00:00:05"), "'popUpReminder(""Hello"")'"
End Sub
答案 2 :(得分:0)
↑这些规则↑对df <- structure(list(Sample1 = c(6.53845, 6.34303, 6.17286), Sample2 = c(6.38723,
6.52751, 6.31772), Sample3 = c(6.41613, 6.48025, 6.44266), Sample4 = c(6.07901,
6.79185, 6.61777), Sample5 = c(6.45148, 6.94955, 7.05509)), .Names = c("Sample1",
"Sample2", "Sample3", "Sample4", "Sample5"), class = "data.frame", row.names = c("Gene1",
"Gene2", "Gene3"))
batch_lookup <- structure(list(Sample = c("Sample1", "Sample2", "Sample3", "Sample4",
"Sample5"), Batch = c("A", "A", "B", "A", "C")), .Names = c("Sample",
"Batch"), class = "data.frame", row.names = c(NA, -5L))
,Application.OnTime
或Application.Run
均适用。
您可以每次都执行上述所有操作,也可以编写一个子例程来为您执行此操作。或者,您也可以复制并粘贴我写的内容:
Control.OnAction
答案 3 :(得分:0)
另一个重复事件的变化
Sub Test()
For i = 5 To 12
Application.OnTime TimeValue(Format(i, "00") & ":00:00"), "'DoCopy " & i & "'"
Next
End Sub