Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default 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
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
How can I reset the default pie chart label "Other" to "Equity"? russ Charts and Charting in Excel 1 December 3rd 09 08:31 PM
Pivot tables - how do I change default from "count of" to "sum of" Cathy H Excel Worksheet Functions 2 November 19th 08 01:31 AM
Rounding up to nearest 10 when "Enter" is pressed or user has clickedoff the cell Maddoktor Excel Programming 2 January 16th 07 11:19 PM
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? StargateFanFromWork[_4_] Excel Programming 7 October 29th 06 11:46 AM
Make "Edit" mode default, rather than "Enter"? Greg Boettcher Excel Discussion (Misc queries) 1 July 27th 06 01:46 AM


All times are GMT +1. The time now is 03:42 AM.

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"