Function to test if the current time is within a time window
You are taking a DateTime, formatting it to a string, then assigning that to another datetime, just to get the time of day. That won't compile with Option Strict On. What you want is provided by DateTime.TimeOfDay.

I would also change ByRef to ByVal in the parameter list.

Once you are comparing timespan instead of date, you don't have to do date addition. You can just detect the wrap-around case and you only have to check endTime.

 Public Function IsCurrentTimeBetween(ByVal dteStartTime As DateTime, ByVal dteEndTime As DateTime) As Boolean

            Dim startTime, endTime, currentTime As TimeSpan

            startTime = dteStartTime.TimeOfDay
            endTime = dteEndTime.TimeOfDay
            currentTime = Now.TimeOfDay

            If endTime &lt; startTime Then
                'the times span midnight     
                Return (currentTime &lt;= endTime)
            Else
                'the times do not span midnight
                Return (startTime &lt;= currentTime AndAlso currentTime &lt;= endTime)
            End If

End Function