Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
ntoze
 
Posts: n/a
Default Full path in title bar

Further to my earlier message, this class can be added to give a
reliable 'read-only' tag in the title bar when using the full path in
title bar code.


[Class ToggleReadOnlyEvents]

Option Explicit

Private WithEvents togReadOnlyButton As Office.CommandBarButton

Private Sub Class_Initialize()
' Not sure if this ID is stable. Could use the name instead.
Set togReadOnlyButton = CommandBars.FindControl(ID:=456)
End Sub

Private Sub Class_Terminate()
Set togReadOnlyButton = Nothing
End Sub

Private Sub togReadOnlyButton_Click( _
ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
Dim Wb As Workbook
Set Wb = ActiveWorkbook

If Wb.ReadOnly = True Then
If GetAttr(Wb.FullName) And vbReadOnly Then
MsgBox "'" & Wb.Name & "' is read-only." _
& " To save a copy, click OK, then give the" _
& " workbook a new name in the Save As dialog box.", _
vbExclamation, "Microsoft Excel"
Else
Wb.ChangeFileAccess xlReadWrite
End If
Else
Wb.ChangeFileAccess xlReadOnly
End If

showFullName Wb

CancelDefault = True
End Sub

Private Sub showFullName(Wb As Workbook)
Dim caption As String
On Error Resume Next

caption = Wb.FullName
If Wb.ReadOnly Then
caption = caption & " [Read-Only]"
End If

Wb.Windows(1).caption = caption
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
ntoze
 
Posts: n/a
Default Full path in title bar

There seems to be a problem with putting the path in the title bar
using the workbook open event. The problem is, if you have code like
this:

Set a_workbook = Application.Workbooks.Open("abc.xls", 0, True)

And abc.xls has a VBA reference to another workbook. Then a_workbook
will (or at least it will with my workbook) be set to the referenced
workbook, not abc.xls. Which is not the behaviour if the workbook open
event is not used.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Full path in title bar ntoze Excel Discussion (Misc queries) 0 February 21st 06 08:26 PM
Can the full path be shown in the Title Bar? markvi Excel Discussion (Misc queries) 3 November 23rd 05 06:29 PM
Show full path title in title bar? Nor New Users to Excel 4 November 4th 05 07:00 PM
full UNC path in footer muttdaemon Excel Discussion (Misc queries) 1 October 12th 05 06:21 PM
How to change the Excel Title Bar to show the full file path na... lmilkey8855 Excel Discussion (Misc queries) 2 January 6th 05 04:08 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"