This seems to me a good way to do it.
In a new workbook, create a class named AppEvents and put the following
code in it:
Option Explicit
Public WithEvents App As Application
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
showFullName Wb
End Sub
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook,
ByVal SaveAsUI As Boolean, Cancel As Boolean)
Static inEvent As Boolean
If SaveAsUI Then
If inEvent Then
Exit Sub
End If
inEvent = True
Application.Dialogs(xlDialogSaveAs).Show
showFullName ActiveWorkbook
Cancel = True
inEvent = False
End If
End Sub
Private Sub showFullName(Wb As Workbook)
Dim caption As String
On Error Resume Next
caption = Wb.FullName
' There doesn't seem to be an event for toggling read-only,
' so I think it is better to not display this rather
' than deceive.
' If Wb.ReadOnly Then
' caption = caption amp; quot; [Read-Only]quot;
' End If
Wb.Windows(1).caption = caption
End SubThen add a module and put this in:
Dim x As New AppEvents
Public Sub Auto_Open()
Set x.App = Application
End SubThen compile and save the workbook as an xla.
Then include it in Tools-gt;Add Ins.
- Aug 14 Mon 2006 20:09
Full path in title bar
close
全站熱搜
留言列表
發表留言