Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Closing a workbook

Hi,

I need (if possible) for a workbook to close if the "Disable Macro" button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Closing a workbook

I know of no way to do that. Closing the workbook automatically would take
a VBA macro and that macro would not run if macros are disabled.
But there are other ways of insuring that the workbook is opened in the way
you want. Post back and detail what you are doing and what you want. HTH
Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro" button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Closing a workbook

Basically, you can setup a macro that runs whenever the file is closed.
That macro would set your data to a condition that would render the workbook
useless. Then you would have another macro that fires whenever the workbook
is opened. That macro would reset your data to what you want. HTH Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro" button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Closing a workbook

Basically what happened was, a login box appeared and the "Macro Security"
options didn't appear.

Now the options do (Enable/Disable Macros).

If you disable the macros you can see everything on the sheet, what i need
is for them to see nothing. Could i do something on the close application
macro to maybe hide everything and protect everything and then if they login
properly and select the enable macro button to show it all again?

Would this be possible?

"Otto Moehrbach" wrote:

Basically, you can setup a macro that runs whenever the file is closed.
That macro would set your data to a condition that would render the workbook
useless. Then you would have another macro that fires whenever the workbook
is opened. That macro would reset your data to what you want. HTH Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro" button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Closing a workbook

Put these 2 macros in the Workbook module. I assumed that you have a splash
sheet named "Splash". When the file is closed by the user, the first macro
will fire and will make the Splash sheet visible and all the others
VeryHidden. If the file is subsequently opened with macros disabled, all
the user will see is the Splash sheet. If the workbook is opened with
macros enabled, all the sheets will be made visible and the Splash sheet
will be made VeryHidden. HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Sheets("Splash").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVeryHidden
Next ws
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVisible
Next ws
Sheets("Splash").Visible = xlSheetVeryHidden
End Sub
"N1KO" wrote in message
...
Basically what happened was, a login box appeared and the "Macro Security"
options didn't appear.

Now the options do (Enable/Disable Macros).

If you disable the macros you can see everything on the sheet, what i need
is for them to see nothing. Could i do something on the close application
macro to maybe hide everything and protect everything and then if they
login
properly and select the enable macro button to show it all again?

Would this be possible?

"Otto Moehrbach" wrote:

Basically, you can setup a macro that runs whenever the file is closed.
That macro would set your data to a condition that would render the
workbook
useless. Then you would have another macro that fires whenever the
workbook
is opened. That macro would reset your data to what you want. HTH Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro"
button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Closing a workbook

Thanks Otto

"Otto Moehrbach" wrote:

Put these 2 macros in the Workbook module. I assumed that you have a splash
sheet named "Splash". When the file is closed by the user, the first macro
will fire and will make the Splash sheet visible and all the others
VeryHidden. If the file is subsequently opened with macros disabled, all
the user will see is the Splash sheet. If the workbook is opened with
macros enabled, all the sheets will be made visible and the Splash sheet
will be made VeryHidden. HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Sheets("Splash").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVeryHidden
Next ws
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVisible
Next ws
Sheets("Splash").Visible = xlSheetVeryHidden
End Sub
"N1KO" wrote in message
...
Basically what happened was, a login box appeared and the "Macro Security"
options didn't appear.

Now the options do (Enable/Disable Macros).

If you disable the macros you can see everything on the sheet, what i need
is for them to see nothing. Could i do something on the close application
macro to maybe hide everything and protect everything and then if they
login
properly and select the enable macro button to show it all again?

Would this be possible?

"Otto Moehrbach" wrote:

Basically, you can setup a macro that runs whenever the file is closed.
That macro would set your data to a condition that would render the
workbook
useless. Then you would have another macro that fires whenever the
workbook
is opened. That macro would reset your data to what you want. HTH Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro"
button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing a workbook from a macro doesn't close the workbook Dave P Excel Programming 2 July 10th 07 06:16 PM
Closing a workbook Gert-Jan[_3_] Excel Programming 3 December 4th 06 11:12 AM
Closing a Workbook Brian Matlack[_42_] Excel Programming 1 January 12th 06 12:48 AM
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"