ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for Menu at start up (https://www.excelbanter.com/excel-programming/398601-macro-menu-start-up.html)

Eric

Macro for Menu at start up
 
Hello all,

When I start a program I want the auto calculation to automaticly come on.
I also want to ensure that when the program is open that no one can get to
the macros. When the program is closed I want it to auto save and for
anyother program that opens to open with a "normal" menu bar. I hope this
makes sense.......Thank you in advance for all your help.

Eric

JRForm

Macro for Menu at start up
 
Eric,

Here is some code for the autocalculation and saving.

By your words; "no one can get to the macros." Are you trying to block them
from the project or from running a macro period?

'Put this in a Auto_Open sub
With Application
.Calculation = xlAutomatic
End With

'Do this to keep people from your code
Go to Tools VBAProject properties, lock the project for viewing, and enter
a password.

'Put this in a auto_Close sub
ActiveWorkbook.Save


"Eric" wrote:

Hello all,

When I start a program I want the auto calculation to automaticly come on.
I also want to ensure that when the program is open that no one can get to
the macros. When the program is closed I want it to auto save and for
anyother program that opens to open with a "normal" menu bar. I hope this
makes sense.......Thank you in advance for all your help.

Eric


Eric

Macro for Menu at start up
 
this is good but how do I get this macro to activate automaticly when I open
this book?
Also, you told me about the auto_close sub How do I get that to work
automaticly?

As you can see this is new territory for me.......

Eric

"JRForm" wrote:

Eric,

Here is some code for the autocalculation and saving.

By your words; "no one can get to the macros." Are you trying to block them
from the project or from running a macro period?

'Put this in a Auto_Open sub
With Application
.Calculation = xlAutomatic
End With

'Do this to keep people from your code
Go to Tools VBAProject properties, lock the project for viewing, and enter
a password.

'Put this in a auto_Close sub
ActiveWorkbook.Save


"Eric" wrote:

Hello all,

When I start a program I want the auto calculation to automaticly come on.
I also want to ensure that when the program is open that no one can get to
the macros. When the program is closed I want it to auto save and for
anyother program that opens to open with a "normal" menu bar. I hope this
makes sense.......Thank you in advance for all your help.

Eric


JRForm

Macro for Menu at start up
 
Eric,

Open the code window and look in the project pane for "This Workbook" and
select it.
Post this in the code module. Once your code is in place then close and
open the file

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'place code in here to execute the code at close of spreadsheet

End Sub


Private Sub Workbook_Open()
'Place code in here if you want it run when the file is opened

End Sub

"Eric" wrote:

this is good but how do I get this macro to activate automaticly when I open
this book?
Also, you told me about the auto_close sub How do I get that to work
automaticly?

As you can see this is new territory for me.......

Eric

"JRForm" wrote:

Eric,

Here is some code for the autocalculation and saving.

By your words; "no one can get to the macros." Are you trying to block them
from the project or from running a macro period?

'Put this in a Auto_Open sub
With Application
.Calculation = xlAutomatic
End With

'Do this to keep people from your code
Go to Tools VBAProject properties, lock the project for viewing, and enter
a password.

'Put this in a auto_Close sub
ActiveWorkbook.Save


"Eric" wrote:

Hello all,

When I start a program I want the auto calculation to automaticly come on.
I also want to ensure that when the program is open that no one can get to
the macros. When the program is closed I want it to auto save and for
anyother program that opens to open with a "normal" menu bar. I hope this
makes sense.......Thank you in advance for all your help.

Eric



All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com