Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default force users to enable macro so sheet cannot be printed

in access 2003 I have code that will stop users from printing the sheet.Now
that I have added a macro users can print if they do not enable the macro.Is
there anyway to stop this happening?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default force users to enable macro so sheet cannot be printed

You need a contingency plan that renders the workbook useless if users do
not enable macros.

Here is a sample................

Create a sheet named Dummy with a large message typed in the middle.

"You have disabled Macros and this workbook is useless without them. Please
close and re-open with macros enabled"

Then add these two event codes to Thisworkbook module.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
Application.ScreenUpdating = False
Sheets("Dummy").Visible = xlSheetVisible
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
ThisWorkbook.Save
End Sub

Private Sub Workbook_Open()
Dim sht As Worksheet
Application.ScreenUpdating = False
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = True
Sheets("Dummy").Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 10 Dec 2008 10:10:01 -0800, Zambian
wrote:

in access 2003 I have code that will stop users from printing the sheet.Now
that I have added a macro users can print if they do not enable the macro.Is
there anyway to stop this happening?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default force users to enable macro so sheet cannot be printed

Zambian-
You posted your question about access in an excel post. Are you working with
Access or Excel?

"Gord Dibben" wrote:

You need a contingency plan that renders the workbook useless if users do
not enable macros.

Here is a sample................

Create a sheet named Dummy with a large message typed in the middle.

"You have disabled Macros and this workbook is useless without them. Please
close and re-open with macros enabled"

Then add these two event codes to Thisworkbook module.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
Application.ScreenUpdating = False
Sheets("Dummy").Visible = xlSheetVisible
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
ThisWorkbook.Save
End Sub

Private Sub Workbook_Open()
Dim sht As Worksheet
Application.ScreenUpdating = False
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = True
Sheets("Dummy").Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 10 Dec 2008 10:10:01 -0800, Zambian
wrote:

in access 2003 I have code that will stop users from printing the sheet.Now
that I have added a macro users can print if they do not enable the macro.Is
there anyway to stop this happening?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default force users to enable macro so sheet cannot be printed

Sorry . Working in excel 2003

"DStrong" wrote:

Zambian-
You posted your question about access in an excel post. Are you working with
Access or Excel?

"Gord Dibben" wrote:

You need a contingency plan that renders the workbook useless if users do
not enable macros.

Here is a sample................

Create a sheet named Dummy with a large message typed in the middle.

"You have disabled Macros and this workbook is useless without them. Please
close and re-open with macros enabled"

Then add these two event codes to Thisworkbook module.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
Application.ScreenUpdating = False
Sheets("Dummy").Visible = xlSheetVisible
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
ThisWorkbook.Save
End Sub

Private Sub Workbook_Open()
Dim sht As Worksheet
Application.ScreenUpdating = False
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = True
Sheets("Dummy").Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Wed, 10 Dec 2008 10:10:01 -0800, Zambian
wrote:

in access 2003 I have code that will stop users from printing the sheet.Now
that I have added a macro users can print if they do not enable the macro.Is
there anyway to stop this happening?



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
Allow users of protected sheet to use macro involving custom filte Roady Excel Discussion (Misc queries) 3 June 17th 08 04:41 PM
how do i force users to first enter data in one cell before anythi des-sa[_2_] Excel Discussion (Misc queries) 2 June 3rd 08 10:29 PM
how to enable a macro in protected sheet Steve Eastham Excel Discussion (Misc queries) 2 May 4th 07 03:34 PM
Force users to enable macros when open a workbook Tan New Users to Excel 2 April 15th 07 05:09 PM
How can force enable macros to be able to open my workbook? kcdonaldson Excel Discussion (Misc queries) 3 December 5th 05 06:16 PM


All times are GMT +1. The time now is 11:42 PM.

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

About Us

"It's about Microsoft Excel"