寻找 Strright 的 VBA 等价物

Looking for VBA equivalent for Strright

正在寻找 LotusScript 的 Strright 的 VBA 等价物。该代码段用于将错误消息连接到一个单元格中。

LotusScript Strright

'Meera's error message code
ReDim Preserve errormsg(i)
errormsg(i) = "Field Required"
IsError = True

...
errormsg(i) = "Invalid Date"
etc...

If IsError = True Then
   tmpMsg = ""
   For Each v In errormsg
       tmpMsg = tmpMsg + "," + v
   Next v
   Cells(Row, 8).Value = strright(tmpMsg, ",")      'LotusScript
End If

您可以使用Join()

If IsError = True Then
   Cells(Row, 8).Value = Join(errormsg, ",")
End If

或使用此模式:

If IsError = True Then
   Dim sep
   tmpMsg = ""
   For Each v In errormsg
       tmpMsg = tmpMsg + sep + v
       sep = ","
   Next v
   Cells(Row, 8).Value = tmpMsg
End If