![]() |
Insert Character - Built-In Excel Commands
In Excel 2003, a toolbar can be customized using
Tools|Customize|Commands and dragging certain buttons to the toolbar. Some of these buttons can be used to insert special characters while typing, such as these: = + - * / ^ ( ) : , % $ There is also a button with the Greek letter omega on it for calling up the insert symbol dialog box. I would like to create a toolbar consisting of buttons that insert special characters on the fly like these buttons. I would like to have a button for, among other things, each of the Greek letters from the unicode set used by the Excel insert symbol dialog box. I don't want to use the Symbol font, but rather the Times New Roman font with its unicode Greek letters, which is what the Excel insert symbol dialog box uses. Rather than having to invoke the insert symbol dialog, scroll down to the Greek Letters, and select the one I want, I want to just click on a toolbar button for that letter. I assume there is a command that the built-in Excel buttons invokes for the button for each of the characters = + - * / ^ ( ) : , % $ I assume that I can invoke the same command, and just replace the character. However, I can't figure out what those commands are. Does anybody have any idea how to accomplish my goal? What commands are invoked by the buttons listed above? Is there a comprehensive list of Excel commands such as the list of Word commands he http://word.mvps.org/FAQs/General/CommandsList.htm |
Insert Character - Built-In Excel Commands
Tonto..
nice one to play with :) if your (windows defined) font used for the toolbars doesnt support unicode you may have a problem, else this seems to work :) the onaction string is hardcoded for Module1.. (so all procs can be in an addin and Private) adapt to needs... Sub BuildGreek() Dim i% Const uc = &H390 On Error Resume Next With Application ..CommandBars("greek").Delete On Error GoTo 0 With .CommandBars.Add("greek", msoBarTop, , True) For i = 1 To 25 If i < 18 Then With .Controls.Add(msoControlButton, , ChrW(i + uc), , True) .Style = msoButtonCaption .OnAction = ThisWorkbook.Name & "!module1.DoGreek" .Caption = ChrW(i + uc) End With End If Next ..Visible = True End With End With End Sub Sub DoGreek() ActiveCell.Value = Application.CommandBars.ActionControl.Parameter ActiveCell.Font.Name = "Courier New" End Sub keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool Tonto wrote: In Excel 2003, a toolbar can be customized using Tools|Customize|Commands and dragging certain buttons to the toolbar. Some of these buttons can be used to insert special characters while typing, such as these: = + - * / ^ ( ) : , % $ There is also a button with the Greek letter omega on it for calling up the insert symbol dialog box. I would like to create a toolbar consisting of buttons that insert special characters on the fly like these buttons. I would like to have a button for, among other things, each of the Greek letters from the unicode set used by the Excel insert symbol dialog box. I don't want to use the Symbol font, but rather the Times New Roman font with its unicode Greek letters, which is what the Excel insert symbol dialog box uses. Rather than having to invoke the insert symbol dialog, scroll down to the Greek Letters, and select the one I want, I want to just click on a toolbar button for that letter. I assume there is a command that the built-in Excel buttons invokes for the button for each of the characters = + - * / ^ ( ) : , % $ I assume that I can invoke the same command, and just replace the character. However, I can't figure out what those commands are. Does anybody have any idea how to accomplish my goal? What commands are invoked by the buttons listed above? Is there a comprehensive list of Excel commands such as the list of Word commands he http://word.mvps.org/FAQs/General/CommandsList.htm |
Insert Character - Built-In Excel Commands
Thanks. I changed it slightly like below to more efficiently account
for the small Greek letters, which I added. I also changed to module reference to basGreek instead of Module1, so that I can put it in its owm module in the Personal Macro Workbook. This is a great start. However, what the DoGreek sub does is to change the value of the active cell to the selected Greek letter. What I want to do is to emulate the functionality of the = + - * / ^ ( ) : , % $ optional buttons which a user can place on a toolbar using Tools|Customize|Commands. These buttons, clicked when actively editing a cell, will insert the appropriate character into the cell at the point of the cursor. I am hoping somebody can tell me what commands these buttons invoke so that I can apply a modified version to your code. It is excellent, thank you. Sub BuildGreek() Dim i% Const uc = &H390 With Application On Error Resume Next .CommandBars("Greek").Delete On Error GoTo 0 With .CommandBars.Add("Greek", msoBarTop, , True) For i = 1 To 57 Select Case i Case 18, 26 To 32 'Do nothing. Case Else With .Controls.Add(msoControlButton, , ChrW(i + uc), , True) .Style = msoButtonCaption .OnAction = ThisWorkbook.Name & "!basGreek.DoGreek" .Caption = ChrW(i + uc) End With End Select Next .Visible = True End With End With End Sub Sub DoGreek() ActiveCell.Value = Application.CommandBars.ActionControl.Parameter ActiveCell.Font.Name = "Courier New" End Sub On Tue, 06 Jul 2004 17:24:53 -0700, keepITcool wrote: Tonto.. nice one to play with :) if your (windows defined) font used for the toolbars doesnt support unicode you may have a problem, else this seems to work :) the onaction string is hardcoded for Module1.. (so all procs can be in an addin and Private) adapt to needs... Sub BuildGreek() Dim i% Const uc = &H390 On Error Resume Next With Application .CommandBars("greek").Delete On Error GoTo 0 With .CommandBars.Add("greek", msoBarTop, , True) For i = 1 To 25 If i < 18 Then With .Controls.Add(msoControlButton, , ChrW(i + uc), , True) .Style = msoButtonCaption .OnAction = ThisWorkbook.Name & "!module1.DoGreek" .Caption = ChrW(i + uc) End With End If Next .Visible = True End With End With End Sub Sub DoGreek() ActiveCell.Value = Application.CommandBars.ActionControl.Parameter ActiveCell.Font.Name = "Courier New" End Sub keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool Tonto wrote: In Excel 2003, a toolbar can be customized using Tools|Customize|Commands and dragging certain buttons to the toolbar. Some of these buttons can be used to insert special characters while typing, such as these: = + - * / ^ ( ) : , % $ There is also a button with the Greek letter omega on it for calling up the insert symbol dialog box. I would like to create a toolbar consisting of buttons that insert special characters on the fly like these buttons. I would like to have a button for, among other things, each of the Greek letters from the unicode set used by the Excel insert symbol dialog box. I don't want to use the Symbol font, but rather the Times New Roman font with its unicode Greek letters, which is what the Excel insert symbol dialog box uses. Rather than having to invoke the insert symbol dialog, scroll down to the Greek Letters, and select the one I want, I want to just click on a toolbar button for that letter. I assume there is a command that the built-in Excel buttons invokes for the button for each of the characters = + - * / ^ ( ) : , % $ I assume that I can invoke the same command, and just replace the character. However, I can't figure out what those commands are. Does anybody have any idea how to accomplish my goal? What commands are invoked by the buttons listed above? Is there a comprehensive list of Excel commands such as the list of Word commands he http://word.mvps.org/FAQs/General/CommandsList.htm |
Insert Character - Built-In Excel Commands
Tonto..
problem is.. as soon as your are in Edit Mode you cant run macro's.. i've already tried to subclass the buttons... no go :( i've already tried if it would work from menuitem iso button.. no go:( i'll do some research... maybe you rephrase and start a new thread? "How to exec a commandbar button while in edit mode" see if i can hack into this.. (or add a page to the insert symbol dialog... or maybe it's all very simple and we're just missing the obvious... <grin... hmmmm keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool Tonto wrote: Thanks. I changed it slightly like below to more efficiently account for the small Greek letters, which I added. I also changed to module reference to basGreek instead of Module1, so that I can put it in its owm module in the Personal Macro Workbook. This is a great start. However, what the DoGreek sub does is to change the value of the active cell to the selected Greek letter. What I want to do is to emulate the functionality of the = + - * / ^ ( ) : , % $ optional buttons which a user can place on a toolbar using Tools|Customize|Commands. These buttons, clicked when actively editing a cell, will insert the appropriate character into the cell at the point of the cursor. I am hoping somebody can tell me what commands these buttons invoke so that I can apply a modified version to your code. It is excellent, thank you. Sub DoGreek() ActiveCell.Value = Application.CommandBars.ActionControl.Parameter ActiveCell.Font.Name = "Courier New" End Sub |
Insert Character - Built-In Excel Commands
I see your point. I'll have to think more on that one. Thank you for
looking into it also. On Wed, 07 Jul 2004 07:53:33 -0700, keepITcool wrote: Tonto.. problem is.. as soon as your are in Edit Mode you cant run macro's.. i've already tried to subclass the buttons... no go :( i've already tried if it would work from menuitem iso button.. no go:( i'll do some research... maybe you rephrase and start a new thread? "How to exec a commandbar button while in edit mode" see if i can hack into this.. (or add a page to the insert symbol dialog... or maybe it's all very simple and we're just missing the obvious... <grin... hmmmm keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool Tonto wrote: Thanks. I changed it slightly like below to more efficiently account for the small Greek letters, which I added. I also changed to module reference to basGreek instead of Module1, so that I can put it in its owm module in the Personal Macro Workbook. This is a great start. However, what the DoGreek sub does is to change the value of the active cell to the selected Greek letter. What I want to do is to emulate the functionality of the = + - * / ^ ( ) : , % $ optional buttons which a user can place on a toolbar using Tools|Customize|Commands. These buttons, clicked when actively editing a cell, will insert the appropriate character into the cell at the point of the cursor. I am hoping somebody can tell me what commands these buttons invoke so that I can apply a modified version to your code. It is excellent, thank you. Sub DoGreek() ActiveCell.Value = Application.CommandBars.ActionControl.Parameter ActiveCell.Font.Name = "Courier New" End Sub |
All times are GMT +1. The time now is 08:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com