View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Toggle custom button caption

Sub Where_amI()
'*** toggles title bar between document name and full path
If ActiveWindow.Caption = ActiveWorkbook.Name Then
application.Commmandbars.Actioncontrol.Caption = "Hide Full File Path"
ActiveWindow.Caption = ActiveWorkbook.FullName
Else: ActiveWindow.Caption = ActiveWorkbook.Name
application.Commandbars.Actioncontrol.Caption = "Show Full File Path"
End If
End Sub

since this is a button on a commandbar, it seems like it already is
interactive.

--
Regards,
Tom Ogilvy


"Tummy" wrote in message
...
Hi group,

Using XL 97
I have created the custom menu which has a few buttons and
one of them is to show the full file path.

‘ ********************
'e) Show Full File Path
With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "&Show Full File Path"
.FaceId = 1446
.OnAction = "Where_amI"
End With
‘ ********************

Sub Where_amI()
'*** toggles title bar between document name and full path
If ActiveWindow.Caption = ActiveWorkbook.Name Then
ActiveWindow.Caption = ActiveWorkbook.FullName
Else: ActiveWindow.Caption = ActiveWorkbook.Name
End If
End Sub

How would I toggle the caption of the button from “Show
Full File Path” to “Hide Full File Path?”


Question #2. Is there a way to make it interactive? I
don’t think there’s an After Save routine…

Thanks in advance.

Tummy