LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Public Variable problem

I have the line below in a module:

Public NoSave As Boolean

In my Auto_Open routine I have:

Sub Auto_Open()
'
Events.Enable_Events

If ActiveWorkbook.ReadOnly = True Then

NoSave = True
Protection.ProtectAllSheets
Else
NoSave = False
Protection.UnProtectAllSheets
End If

Module7.StartPoint
Module6.StartTimer

End Sub

Then I in ThisWorkbook ihave the following"

Private Sub Workbook_BeforeClose(Cancel As Boolean)

If NoSave = True Then
ThisWorkbook.Close False
End If

If NoSave = False Then
End If

End Sub

My problem is that when you click on either the Red X to close Excel or the
smaller X to close the workbook you are still prompted to save the workbook.
So it is not seeing NoSave as true, even when it was set to True in te
Auto_Open routine.

 
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
Public variable (or Public Const?) Brettjg Excel Programming 14 April 23rd 09 11:30 PM
Public variable (or Public Const?) Tim Williams[_2_] Excel Programming 0 April 23rd 09 06:33 AM
Problem with Public Variable value being changed. [email protected] Excel Programming 2 January 2nd 08 08:31 PM
strange problem with public variable Gary Keramidas Excel Programming 2 July 8th 07 03:58 PM
Public variable problem moonhk Excel Programming 13 December 8th 06 08:38 AM


All times are GMT +1. The time now is 07:40 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"