Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am looking for a macro that opens a msgbox when exit the workbook to
remind you like "you fill in your working hours?" is that Private Sub AutoClose() ? and where do i put it? |
#2
![]() |
|||
|
|||
![]()
Hi
Better use the beforeclose event so the user can cancel the close Copy this in the thisworkbook module Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim ans As Long ans = MsgBox("Do you fill in your working hours?", vbOKCancel) If ans = vbOK Then 'do nothing ElseIf ans = vbCancel Then Cancel = True End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "toontje" wrote in message l... I am looking for a macro that opens a msgbox when exit the workbook to remind you like "you fill in your working hours?" is that Private Sub AutoClose() ? and where do i put it? |
#3
![]() |
|||
|
|||
![]()
You need Workbook_BeforeClose, as you can Cancel the close
Private Sub Workbook_BeforeClose(Cancel As Boolean) If your condition not met Then Cancel=True End If End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "toontje" wrote in message l... I am looking for a macro that opens a msgbox when exit the workbook to remind you like "you fill in your working hours?" is that Private Sub AutoClose() ? and where do i put it? |
#4
![]() |
|||
|
|||
![]()
You will need to put it in the workbook code.
Right click on the small picture to the left of the menu item "File" select "workbook" in the dropdown next to "general" select "before close" or if you like "before save" in the dropdown next to "open" and enter Msgbox "Heb je je uren ingevuld????" between the lines already there. Have fun. -- Groeten vanuit Nieuw Zeeland Willy Kuunders "toontje" wrote in message l... I am looking for a macro that opens a msgbox when exit the workbook to remind you like "you fill in your working hours?" is that Private Sub AutoClose() ? and where do i put it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with macro looping and color query function | Excel Discussion (Misc queries) | |||
Macro: Exit active workbook without save? | Excel Worksheet Functions | |||
on exit macro | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
Date macro | Excel Discussion (Misc queries) |