Mick Peters
Board Regular
- Joined
- May 18, 2015
- Messages
- 93
I am able to use VBA but no expert most of the code I use is code I have put together from extracts of others to overcome a particular problem, kind of like lego coding
. I currently have a spread sheet that has a message that displays for 5 seconds if an incorrect entry is made on a user form. That worked until I decided to make a weekly save and clear to reset the work sheet each week without intervention. As the work sheet is open all the time so the timer is running all the time.Now the message timed event no longer seems to work.
I have looked through the codes and cannot see why one would stop another unless you are only allowed 1 timed event to run at a time.
The Code to show the message is below and is attached to a user fork text box after update.
And the code to save and clear part of the spread sheet is attached to the work book on an open event
Any help or advise would be appreciated.
Thank you in advance.
I have looked through the codes and cannot see why one would stop another unless you are only allowed 1 timed event to run at a time.
The Code to show the message is below and is attached to a user fork text box after update.
Code:
Case Else 'Message if the user scannes something other than in , out or new.
'MsgBox "Please enter either IN or OUT"
Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject("WScript.Shell")
'Set the message box to close after 5 seconds
AckTime = 5
Select Case InfoBox.Popup("Please enter either IN or OUT. Please try again. (This window will close automatically after 5 seconds).", _
AckTime, "Inccorect Destination Scanned", 0)
Case 1, -1
And the code to save and clear part of the spread sheet is attached to the work book on an open event
Code:
Private Sub Workbook_Open()
If Weekday(Now()) = 4 Then
Application.OnTime TimeValue("20:10:00"), "Clear_All"
End If
Application.OnTime TimeValue("06:05:00"), "Save"
Application.OnTime TimeValue("18:05:00"), "Save"
Application.WindowState = xlMinimized
Ureg.Show
Ureg.txtName.SetFocus
'Ureg.Show modeless
End Sub
Any help or advise would be appreciated.
Thank you in advance.
Last edited: