View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Changed worksheet file (Excel 2003)

I'd use a macro in my personal.xls file. It wouldn't be the same as the
asterisk indicator (UltraEdit???), but it might be sufficient:

Option Explicit
Sub testme01()
With ActiveWorkbook
MsgBox prompt:="Last changes have been saved: " & .Saved, _
Title:=.FullName
End With
End Sub

Assign it to a button on your favorite toolbar or give it a shortcut key.

==========
You could use something like this, but it has a problem:

It checks each time you change the selection to see if the workbook has been
saved. So it could be off by one selection.

If you save the workbook, then the indicator won't change from book1.xls* to
book1.xls until you select a different cell in that same workbook.

If you want to try, you could use something like this:

Option Explicit
Public WithEvents xlApp As Excel.Application
Private Sub Workbook_Open()
Set xlApp = Application
End Sub
Private Sub Workbook_Close()
Set xlApp = Nothing
End Sub
Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

Dim myStr As String

myStr = Sh.Parent.Name

If Sh.Parent.Saved = False Then
myStr = myStr & "*"
End If

ActiveWindow.Caption = myStr

End Sub

This is an application event. Put this into a workbook that's always opened
when you open excel.

One possible workbook is your personal.xls stored in your XLStart folder.
Another possible workbook is an addin (located anywhere you want), but installed
via tools|addins.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

If you want to read more about these kinds of events:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

And you can read about application events on Chip's site:
http://www.cpearson.com/excel/AppEvent.htm



GARY wrote:

Is there any indicator that can be displayed to alert the user that
un-saved changes have been made to a worksheet?

(In some other applications, an asterisk ( * ) is displayed next to the
file-name in the Title Bar).


--

Dave Peterson