Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
set toggleButtons to "pressed" by default
Hi,
I have created a toolbar on Excel 2007. I have set of toggleButtons on the toolbar. Im wondering, if i could set anyone of the toggleButton "pressed" when an excel file is opened. when I open an excel file, toggleButtons on my custom toolbar on by default apprear "unpressed". Here's my requirement, is there any procedure to set these toggleButtons to "pressed" by default. Regards, Shiva |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
set toggleButtons to "pressed" by default
This example is from the Excel Help. You can find it by searching for "State
Property". To get it to work when you open Excel, you should place the code in the "Open" routine of either the workbook you are opening, or your "PERSONAL.XLS" file. Then, when Excel opens, the code is run and the buttons on the command bar will be initialized as you desire. HTH. This example creates a command bar named Custom and adds two buttons to it. The example then sets the button on the left to msoButtonUp and sets the button on the right to msoButtonDown. Dim myBar As Office.CommandBar Dim imgSource As Office.CommandBarButton Dim myControl1 As Office.CommandBarButton Dim myControl2 As Office.CommandBarButton ' Add new command bar. Set myBar = CommandBars.Add(Name:="Custom", Position:=msoBarTop, Temporary:=True) ' Add 2 buttons to new command bar. With myBar .Controls.Add Type:=msoControlButton .Controls.Add Type:=msoControlButton .Visible = True End With ' Paste Bold button face and set State of first button. Set myControl1 = myBar.Controls(1) Set imgSource = CommandBars.FindControl(msoControlButton, 113) imgSource.CopyFace With myControl1 .PasteFace .State = msoButtonUp End With ' Paste Italics button face and set State of second button. Set myControl2 = myBar.Controls(2) Set imgSource = CommandBars.FindControl(msoControlButton, 114) imgSource.CopyFace With myControl2 .PasteFace .State = msoButtonDown End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I reset the default pie chart label "Other" to "Equity"? | Charts and Charting in Excel | |||
Pivot tables - how do I change default from "count of" to "sum of" | Excel Worksheet Functions | |||
Rounding up to nearest 10 when "Enter" is pressed or user has clickedoff the cell | Excel Programming | |||
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? | Excel Programming | |||
Make "Edit" mode default, rather than "Enter"? | Excel Discussion (Misc queries) |