View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Hageman[_4_] Phil Hageman[_4_] is offline
external usenet poster
 
Posts: 81
Default Change Message on Protected Worksheet

In Excel 2000: Using the below code to open a workbook with password
protected worksheets. Opens okay. When the user clicks the €œX€ Close Window
button, a warning message comes up:

Do you want to save the changes you made to €˜ICM A1.xls? Two questions:

1. Why the message? The user cannot make changes on the protected worksheets.
2. Is there a way to bypass this message such that when the user clicks
Close Window, the workbook closes, according to the Auto_Close code?


Option Explicit

Sub Auto_Open()
Dim WS As Worksheet
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Application.EnableEvents = False

For Each WS In ThisWorkbook.Worksheets
If WS.Visible = xlSheetVisible Then
WS.Select
Application.Goto WS.Range("A1"), True
ActiveWindow.DisplayGridlines = False
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.WindowState = xlMaximized
ActiveWindow.View = xlNormalView
End If
Next

Application.Goto Reference:=Range("A100"), Scroll:=False
Application.EnableEvents = True
End Sub


Sub Auto_Close()
Application.Goto Reference:=Range("A1"), Scroll:=True
Application.Goto Reference:=Range("A100"), Scroll:=False
Application.DisplayFullScreen = False
ActiveWindow.DisplayWorkbookTabs = True
ActiveWindow.DisplayHeadings = True
ActiveWindow.DisplayHorizontalScrollBar = True
Application.ScreenUpdating = True
End Sub