Macro security help

  • Thread starter Thread starter Cloudy
  • Start date Start date
C

Cloudy

Hi all,

i want people whose macro security that is set to middle, cannot open the
file. It would be appreciated if the application will auto close the
window/application.

Is there any code for this? If so please advice! Thanks!
 
Thanks for your response and suggestion. But i am new in VBA. If i want to
use your suggestion into my situation, where do i place the codes? Below is
what i have.


Option Explicit

Const WelcomePage = "Prompt"

Sub Workbook_Open()
'Unhide all worksheets
Application.ScreenUpdating = False
Call ShowAllSheets
End Sub

Sub ShowAllSheets()
'Show all worksheets except the macro welcome page
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVisible
Next ws
Worksheets(WelcomePage).Visible = xlSheetVeryHidden
End Sub

Sub Workbook_BeforeClose(Cancel As Boolean)
Call HideAllSheets
ThisWorkbook.Saved = True
End Sub

Sub HideAllSheets()
'Hide all worksheets except the macro welcome page
Dim ws As Worksheet
Worksheets(WelcomePage).Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVeryHidden
Next ws
Worksheets(WelcomePage).Activate
End Sub

Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 44 Then
Clipboard.Clear
End If
End Sub
 
Back
Top