View Full Version : when button on toolbar pressed
saban
03-09-2006, 06:07 AM
I have a question about button on custom toolbar
It is a button with ON/OFF text on it
How can I do when toolbar is visible that button should looks like it is pressed or when toolbar is not visible the button should look like unpressed
( I guuess something like Button.State = msoButtonDown)
Here is the code:
Sub vklopiizklopi()
With CommandBars("VSE")
If .Visible = True Then
.Visible = False
Else
If .Visible = False Then
.Visible = True
End If
End If
End With
Exit Sub
End Sub
Thnx
saban
03-09-2006, 06:19 AM
the toolbar name is "Izklopi/vklopi" - the one that ON/OFF button is on
saban
03-09-2006, 06:41 AM
Ok I figured it out
But is it possible to change color of button to red or blue
mdmackillop
03-09-2006, 05:27 PM
To simplify your initial code, try
Sub vklopiizklopi()
With CommandBars("VSE")
.Visible = Not(.Visible)
End With
End Sub
With regard to your alternating buttons, why not create 2 buttons and toggle them visible/hidden
Regards
MD
saban
03-10-2006, 01:55 AM
Sub vklopiizklopi()
With CommandBars("VSE")
If .Visible = True Then
.Visible = False
CommandBars("Izklopi").Controls(1).State = msoButtonUp
CommandBars("Izklopi").Controls(1).Caption = "ON/OFF izklopjen"
CommandBars("Izklopi").Controls(1).TooltipText = "preverjanje kod izklopljeno"
Else
If .Visible = False Then
.Visible = True
CommandBars("Izklopi").Controls(1).State = msoButtonDown
CommandBars("Izklopi").Controls(1).Caption = "ON/OFF"
CommandBars("Izklopi").Controls(1).TooltipText = "preverjanje kod vklopljeno"
End If
End If
End With
Exit Sub
End Sub
Ok I have mangaed to change apperance of buttons with this code but now each time I use it and then close the word it asks me if I want to save changes to .dot file (It wants to save changes to template.
I guess it is because this changing of button appearance how could I avoid this message
Thnx
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.