Determine if the sheet has been changed

E

Erik Wikström

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.
 
M

Mike H

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
 
E

Erik Wikström

Mike H said:
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.

Hmm, that might work. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top