View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Determine if the sheet has been changed

Hi,

You could do this:-

Private Sub Workbook_Open()
'Make your changes to headers etc
ActiveWorkbook.Saved = True
End Sub

Only changes made after the line
ActiveWorkbook.Saved = True
Should generate a prompt to save changes when closing.

Mike

"Erik Wikström" wrote:

I have a workbook where on one sheet the user can use a set of buttons and
dialogues to add new column headers to a table and then fill in the correct
default values for each row in that column. The headers shown are stored in
an internal datastructure and to ease insertion of new headers (which might
be inserted in the middle of the table) I have written code that first clears
all headers and then re-draws them whenever the user adds new headers. This
code is also run when the user opens the workbook.

The problem with this is that Excel counts this re-drawing (even if no
change is made) as changing the workbook, so if I just open the book and then
try to close it Excel asks if I want to save since the book has been changed.
So I wonder if it is possible to tell Excel to ignore changed to certain rows
when determining if the workbook has been changed.

--
Erik Wikström