mtheriault2000
Well-known Member
- Joined
- Oct 23, 2008
- Messages
- 826
Hello again
I want to create a function to manipulate strings
My Sub give an error on T1 as an incompatible argument
Any idea where I miss the point???
Martin
I want to create a function to manipulate strings
Code:
Public Function NextBartime(ByRef t1 As String, ByRef t2 As String) As String
' Part of the code by Rick Rothstein
Dim Realt1, realt2 As Date
Dim Newtime As String
Realt1 = CDate(Format(t1, "@@@@-@@-@@ @@@@@@@@"))
realt2 = CDate(Format(t2, "@@@@-@@-@@ @@@@@@@@"))
NexBartime = Format((realt2 - Realt1) + realt2, "yyyymmdd hh:mm:ss")
End Function
Sub testnextbar()
Dim t1, t2, rt As String
t1 = "20110922 18:57:00"
t2 = "20110922 19:00:00"
'Call the function
rt = NextBartime(t1, t2)
End Sub
My Sub give an error on T1 as an incompatible argument
Any idea where I miss the point???
Martin