How to extract the nth element from a VBA string array?
I have a line like: TEST - 2017/01/20 = Invoice
I want to extract the 2nd and 3rd elements as briefly as possible. I tried something like Javascripty that doesn't work, so there must be a VBA way:
Dim Report As String
Dim CurrLine As String
Dim CurrDate As String
Dim CurrTask As String
CurrLine = "TEST - 2017/01/20 = Invoice"
CurrDate = Trim(Split(CurrLine, '-')[1])
CurrTask = Trim(Split(CurrLine, '=')[1])
Report = Report & CHR(34) & CurrDate & CHR(34) & "," & CHR(34) & CurrTask & CHR(34)
//result: "2017/01/20","Invoice"
source
share