Ian Bell
asked on
message box
Hi,
I have lost an Excel file several times for not disconnecting an API program.
Therefore I would like a message box saying "Have you logged off?" that appears when I try to close the Excel workbook. This will act as a reminder and save me from hours of file reconstruction.
Many thanks
Ian
I have lost an Excel file several times for not disconnecting an API program.
Therefore I would like a message box saying "Have you logged off?" that appears when I try to close the Excel workbook. This will act as a reminder and save me from hours of file reconstruction.
Many thanks
Ian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I was wondering, when you make changes in any workbook and if you tries to close that workbook, there is default prompt for saving, do you still need above custom msg box?
ASKER
Hi Shums,
Firstly I don't need any msg box for other files but thanks for asking.
Secondly, As I am not so familiar with VBA can you guide me step by step to copy the above code.
thanks
Ian
Firstly I don't need any msg box for other files but thanks for asking.
Secondly, As I am not so familiar with VBA can you guide me step by step to copy the above code.
thanks
Ian
ASKER
If I select 'yes' I would like to save and exit. Can that be done ?
As per your initial request you did asked for Message Box:
If you are working on one workbook for API Program, then make sure your workbook is saved as .xlsm.
Press Alt+F11 to open visual basic, in project window you will see ThisWorkbook, double click and paste above code.
If you select yes it will be saved, but if its not with xlsm extension, it will not save.
I would like a message box saying "Have you logged off?":)
If you are working on one workbook for API Program, then make sure your workbook is saved as .xlsm.
Press Alt+F11 to open visual basic, in project window you will see ThisWorkbook, double click and paste above code.
If you select yes it will be saved, but if its not with xlsm extension, it will not save.
ASKER
Oh sorry, I meant I have only one workbook that needs the message box
ASKER
Alt F11 only brings up 'immediate window'
ASKER
Yes working fine Shums and thanks again for a quick and professional outcome
Ian
Ian
You're always welcome Ian! :)