I am wondering how to check if a string array at a certain index has not been initialized.
I am using the Split function to determine the file extension of a file path, but in some cases the extension will not be included. My delimiter is ".", so only in the case that the extension is provided will there be a value at array index 1.
I have tried comparing my array at index 1 using Is Nothing, "", IsEmpty, and vbNullString without any success.
I also tried explicitly declaring the size of the array but then I get issues with assigning it to the value of the Split function.
A snippet of my code is as follows:
Dim filePath As String
Dim stringArr() As String
filePath = "C:\Users\Sarchwalk\Documents\fileName"
stringArr() = Split(filePath, ".") 'Problem here if stringArr size has been declared
If stringArr(1) = "" Then 'Error arises here
MsgBox "String array at index 1 is empty"
End If