This is the code. It converts timestamp to total seconds. It works just fine. Here it outputs 42.2143012
Module VBModule
Sub Main()
Console.WriteLine(ConvertToSeconds("00:00:42.2143012"))
End Sub
Function ConvertToSeconds(timestamp As String) As Double
Dim hours As Integer, minutes As Integer, seconds As Integer, milliseconds As Integer
Dim parts() As String, parts2() As String
parts = Split(timestamp, ":")
parts2 = Split(parts(2), ".")
hours = Val(parts(0))
minutes = Val(parts(1))
seconds = Val(parts2(0))
milliseconds = Val(parts2(1))
ConvertToSeconds = (hours * 3600) + (minutes * 60) + seconds + (milliseconds / 10000000)
End Function
End Module
But in Excel, it outputs #VALUE!
, which is unfortunately not what it should be doing. Of course I'm only using the function, not entire code with main. It says nothing more, so it's impossible for me to debug.