Hi There
I have a macro and i want it to be auto run on all excel file automatically
I have saved the code in Pesonal.xls (Which automatcally opens when excel start) but its not working
What does this code does or what i am aiming to achive here
Every time i close any of the excel file it should show me a msg ...if i click on Yes then it closes the file if no then not
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim answer As String
Dim question As String
question = "Have taken rest"
answer = MsgBox(question, vbYesNo)
If answer = vbNo Then
MsgBox "Please take rest"
Cancel = True
Exit Sub
Else
ThisWorkbook.Save
End If
End Sub
Please help me with this
I have a macro and i want it to be auto run on all excel file automatically
I have saved the code in Pesonal.xls (Which automatcally opens when excel start) but its not working
What does this code does or what i am aiming to achive here
Every time i close any of the excel file it should show me a msg ...if i click on Yes then it closes the file if no then not
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim answer As String
Dim question As String
question = "Have taken rest"
answer = MsgBox(question, vbYesNo)
If answer = vbNo Then
MsgBox "Please take rest"
Cancel = True
Exit Sub
Else
ThisWorkbook.Save
End If
End Sub
Please help me with this