为什么我不能退回这个字符串?

时间:2017-01-16 12:26:30

标签: vba function types return

我不明白为什么我可以'返回这个字符串:

    Private usefulData() As Variant
    ' I give dimensions to usefulData in another function
    Private Sub SetUsefulData()
    Dim i As Long
    Dim st As String

    For i = 0 To UBound(myData, 1) - 1
        st = TimeValue(myData(i + 1, ColumnsIndex(2) - 1)) ' Example: "06:09:23"
        usefulData(i, 4) = MTNShiftCheck st ' syntax error
    Next
    End Sub

   Private Function MTNShiftCheck(d As String) As String
   Dim turno As String
   turno = "M"
   MTNShiftCheck = turno
   End Function

我将'st'的值(声明为String)传递给期望String的函数...但我无法编译,因为我收到“语法错误”。无法弄清楚问题出在哪里。

评论中提出的解决方案:MTNShiftCheck(st) 感谢

0 个答案:

没有答案