msg display after fixed interval of time

tushar.tushar

New Member
Joined
May 2, 2009
Messages
1
Dear Friends,

I am trying to create a form in VBA . My concern is

1) A message box should be displayed after every 15 minutes ( any message, say hi)

2) After the message , the timer should start again and re-display the same message again after 15 minutes ... the message loop should continue until i close the form.

Thanks in advance.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Dear Friends,

I am trying to create a form in VBA . My concern is

1) A message box should be displayed after every 15 minutes ( any message, say hi)

2) After the message , the timer should start again and re-display the same message again after 15 minutes ... the message loop should continue until i close the form.

Thanks in advance.


You can try this code.

Code:
Sub MMsgboxTimer()

Application.OnTime Now + TimeValue("00:15:00"), "ShowMsgbox"

End Sub

Sub showmsgbox()

If MsgBox("Hello", vbOKCancel) = vbOK Then
    Call Macro2
End If

End Sub
You need to make it an OK Cancel Messagebox else you would be caught up in an infinite loop Try it out just change the
Code:
TimeValue("00:15:00")
to

Code:
TimeValue("00:00:05")
It will go off every 5 seconds so you don't have to wait 15 mins to test it
 
Upvote 0

Forum statistics

Threads
1,214,403
Messages
6,119,309
Members
448,886
Latest member
GBCTeacher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top