Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Change Message on Protected Worksheet

Try creating a new workbook.
then close it. No prompt.

Create another new workbook
toggle the displaygridlines
close it. You get the prompt.

--
That was the first thing I saw (then I stopped).

If you add some:

msgbox Thisworkbook.saved

throughout your code, you can see what you ran to make excel think your workbook
was dirty (needed saving).

In fact, maybe you can just add:

thisworkbook.saved = true

at the end of your auto_open routine. (If the user changes a setting, they're
on their own.)

Phil Hageman wrote:

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


--

Dave Peterson
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
Change font color in protected worksheet Dyanna Excel Worksheet Functions 2 November 21st 07 01:43 PM
Can I change the tab order in a protected worksheet? sciservice Excel Discussion (Misc queries) 1 May 17th 05 06:42 PM
On a excel protected worksheet, how do I change the tab order? vikgarden Excel Worksheet Functions 3 April 7th 05 04:52 PM
How to change the tab order for a protected worksheet dvonj Excel Worksheet Functions 2 March 18th 05 08:23 PM
how do you change a row height in a protected worksheet Vince[_5_] Excel Programming 3 August 1st 04 06:35 AM


All times are GMT +1. The time now is 08:48 PM.

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"