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).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:=quot;Last changes have been saved: quot; amp; .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 amp; quot;*quot;
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:
www.mvps.org/dmcritchie/excel/getstarted.htm
If you want to read more about these kinds of events:
Chip Pearson's site:
www.cpearson.com/excel/events.htm
David McRitchie's site:
www.mvps.org/dmcritchie/excel/event.htm
And you can read about application events on Chip's site:
www.cpearson.com/excel/AppEvent.htm
GARY wrote:
gt;
gt; Is there any indicator that can be displayed to alert the user that
gt; un-saved changes have been made to a worksheet?
gt;
gt; (In some other applications, an asterisk ( * ) is displayed next to the
gt; file-name in the Title Bar).
--
Dave Peterson
- Sep 23 Tue 2008 20:46
Changed worksheet file (Excel 2003)
close
全站熱搜
留言列表
發表留言
留言列表

