greneebb Posted April 18, 2015 Posted April 18, 2015 Good Day all, I am using the if statement in VBA: If i but the code in the if block executes even though the condition is not met. Can anyone explain this situation Quote
SLW210 Posted April 18, 2015 Posted April 18, 2015 I moved your thread to the .NET, ObjectARX & VBA Forum. It helps to post in the proper forum. Quote
BIGAL Posted April 19, 2015 Posted April 19, 2015 Post the code with the problem. We can only guess your problem. Quote
morkal Posted April 20, 2015 Posted April 20, 2015 Private Function CheckIfTime() As Boolean ' Determine the current day of week and hour of day. Dim dayW As DayOfWeek = DateTime.Now.DayOfWeek Dim hour As Integer = DateTime.Now.Hour ' Return True if Wednesday from 2 to 4 P.M., ' or if Thursday from noon to 1 P.M. If dayW = DayOfWeek.Wednesday Then If hour = 14 Or hour = 15 Then Return True Else Return False End If ElseIf dayW = DayOfWeek.Thursday Then If hour = 12 Then Return True Else Return False End If Else Return False End If End Function Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.