turning off minimize, maximize & close
I want to add a level of security to my file to force the file to auto close by macro only. I've added code to turn of the menus. Is there code I can include to turn off the three icons in the upper left corner; minimize, restor/maximize & close?
Thanks. Kevin |
turning off minimize, maximize & close
Hi
Not sure about the minimise/maximise but you can disable the close button by using a CloseSwitch variable Public CloseSwitch Sub Workbook_Open() CloseSwitch = True 'set the switch to true end sub Sub Workbook Before_Close() Select Case CloseSwitch Case True Cancel = True 'Workbook can't be closed Case False Cancel = False 'Workbook can be closed End Select Having set the CloseSwitch to True on opening the workbook, the workbook can't be closed. Set the CloseSwitch to False in your AutoClose macro and the workbook will close. -----Original Message----- I want to add a level of security to my file to force the file to auto close by macro only. I've added code to turn of the menus. Is there code I can include to turn off the three icons in the upper left corner; minimize, restor/maximize & close? Thanks. Kevin . |
turning off minimize, maximize & close
Make that the three icons in the upper right corner.
----- Kevin wrote: ----- I want to add a level of security to my file to force the file to auto close by macro only. I've added code to turn of the menus. Is there code I can include to turn off the three icons in the upper left corner; minimize, restor/maximize & close? Thanks. Kevin |
turning off minimize, maximize & close
Kevin
under the project explorer double click on workbook put the Public CloseSwitch under the declarations set the CloseSwitch to true under the workbook_open event and the select case in the workbook before_close event None of it is in a module. being public the CloseSwitch can be changed in other procedures such as your macro -----Original Message----- Libby, thanks for the response. However, I can't get this to work. With the following code in Module1, Public CloseSwitch Sub Workbook_Open() CloseSwitch = True End Sub And no other code in the workbook, I am able to close the workbook. Have I applied the code correctly? Also is the following a complete subroutine? Do I place it in a module? Sub Workbook Before_Close() Select Case CloseSwitch Case True Cancel = True 'Workbook can't be closed Case False Cancel = False 'Workbook can be closed End Select Thanks again. Kevin ----- Libby wrote: ----- Hi Not sure about the minimise/maximise but you can disable the close button by using a CloseSwitch variable Public CloseSwitch Sub Workbook_Open() CloseSwitch = True 'set the switch to true end sub Sub Workbook Before_Close() Select Case CloseSwitch Case True Cancel = True 'Workbook can't be closed Case False Cancel = False 'Workbook can be closed End Select Having set the CloseSwitch to True on opening the workbook, the workbook can't be closed. Set the CloseSwitch to False in your AutoClose macro and the workbook will close. -----Original Message----- I want to add a level of security to my file to force the file to auto close by macro only. I've added code to turn of the menus. Is there code I can include to turn off the three icons in the upper left corner; minimize, restor/maximize & close? Thanks. Kevin . . |
turning off minimize, maximize & close
Thanks again Libby
I located the code as you instructed Public CloseSwitc Sub Workbook_Open( CloseSwitch = Tru End Su Sub Workbook_Before_Close( Select Case CloseSwitc Case Tru Cancel = True 'Workbook can't be close Case Fals Cancel = False 'Workbook can be close End Selec Note Workbook_Before_Close rather than Workbook Before_Close. Do I have it correct However, the close switch continues to close the workbook What should I do Thanks Kevi ----- Libby wrote: ---- Kevi under the project explorer double click on workboo put the Public CloseSwitch under the declaration set the CloseSwitch to true under the workbook_open even and the select case in the workbook before_close even None of it is in a module being public the CloseSwitch can be changed in other procedures such as your macr -----Original Message---- Libby, thanks for the response. However, I can't get this to work With the following code in Module1 Public CloseSwitc Sub Workbook_Open( CloseSwitch = Tru End Su And no other code in the workbook, I am able to close the workbook Have I applied the code correctly Also is the following a complete subroutine? Do I place it in a module Sub Workbook Before_Close( Select Case CloseSwitc Case Tru Cancel = True 'Workbook can't be close Case Fals Cancel = False 'Workbook can be close End Selec Thanks again Kevi ----- Libby wrote: ---- H Not sure about the minimise/maximise but you can disable the close button by using a CloseSwitch variabl Public CloseSwitc Sub Workbook_Open( CloseSwitch = True 'set the switch to tru end su Sub Workbook Before_Close( Select Case CloseSwitc Case Tru Cancel = True 'Workbook can't be close Case False Cancel = False 'Workbook can be close End Selec Having set the CloseSwitch to True on opening the workbook, the workbook can't be closed. Set the CloseSwitch to False in your AutoClose macro and the workbook will close -----Original Message---- I want to add a level of security to my file to force the file to auto close by macro only. I've added code to turn of the menus. Is there code I can include to turn off the three icons in the upper left corner; minimize, restor/maximize & close Thanks Kevi |
All times are GMT +1. The time now is 03:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com