Please, try the next function. It returns the date Double value, extracted from string, by adding each its component (Date itself + time + milliseconds time):
Function strToDateDbl(strD As String) As Double
Dim arrStr, arrD, arrT, d As Date, dblTime As Double, dblTDecSec As Double
arrStr = Split(strD, "T"): arrD = Split(arrStr(0), "-")
d = DateSerial(CLng(arrD(0)), CLng(arrD(1)), CLng(arrD(2)))
arrT = Split(arrStr(1), ":")
dblTime = CDbl(CDate(Format(arrT(0) & ":" & arrT(1) & ":" & Int(arrT(2)), "hh:mm:ss"))) 'double of the time part
dblTDecSec = CDbl((CDbl(arrT(2)) - Int(arrT(2))) / 86400) 'double of milliseconds part
strToDateDbl = CDbl(d) + dblTime + dblTDecSec
End Function
You can test it with the next sub:
Sub TestStrToDateDbl()
Dim var1 As String, var2 As String, d1 As Double, d2 As Double
var1 = "2022-08-12T10:32:48.363402": var2 = "2022-08-12T10:32:49.759310"
d1 = strToDateDbl(var1)
d2 = strToDateDbl(var2)
Debug.Print Round((d2 - d1) * 86400, 6) '86400 number of seconds in a day...
End Sub
Edited:
Please, also test the next a little more compact version (inspired by Gustav code). I thought it is better to choose a solution without risk of erroring because of any localization and also to be more precise. I mean, Excel looks to Round the seconds decimals, not truncate them. Anyhow, the next function will return with reasonable accuracy:
Function strToDateDbl(strD As String) As Double
Dim arrT, d As Date, dblTDecSec As Double
d = CDate(Replace(left(strD, 19), "T", " ")): arrT = Split(strD, ":")
dblTDecSec = CDbl((CDbl(arrT(UBound(arrT))) - Int(arrT(UBound(arrT)))) / 86400) 'double of milliseconds part
strToDateDbl = CDbl(d) + dblTDecSec
End Function