A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Creating Custom Toolbars



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2004, 03:26 PM
Vasant Nanavati
external usenet poster
 
Posts: n/a
Default Creating Custom Toolbars

Haven't looked at the code in detail , but within a With ... End With block,
you need to preface properties and methods with a period to relate them to
the With statement. For example:

With NewBtn
..Caption = " "
..OnAction = "FormatChanger"
..TooltipText = "Click to change the Custom format"

etc.

--

Vasant


"excel_naive " wrote in message
...
Hello,
Can anyone help me in understanding how to create a custom
toolbar to have my own format???I have taken some help from an excel
text book and created this code below....But I am not happy with the
way its working cos its not doing what I am loking for....

I am trying to add either another control/button to the built
in list in the Category Menu of the formatcells toolbar
For eg:
we have built in categories like General,Number,Accounting etc etc
...Can I add my own button to this list or...can add my own format to
the list in custom format?? Herz what I have....Any
revisions/modifications to this code to make it work the way I want
greatly appreciated.....
Sub MakeCustomFormatDisplay()
Dim Tbar As CommandBar
Dim NewBtn As CommandBarButton
On Error Resume Next
CommandBars("Custom Format").Delete
On Error GoTo 0

Set Tbar = CommandBars.Add
With Tbar
Name = "Custom Format"
Visible = True
End With
Set NewBtn = CommandBars("Custom
Format").Controls.Add(Type:=msoControlButton)
With NewBtn
Caption = " "
OnAction = "FormatChanger"
TooltipText = "Click to change the Custom format"
Style = msoButtonCaption
End With
Call UpdateToolbar
End Sub
Sub UpdateToolbar()
On Error Resume Next
CommandBars("Custom Format").Controls(1).Caption =
ActiveCell.CustomFormat
End Sub
Sub FormatChanger()
Dim r As Range

For Each r In Selection

If IsNumeric(r.Value) Then
Select Case r.Value
Case 1
r.Value = "Read Only"
Case 2
r.Value = "Assessor"
Case 3
r.Value = "Reviewer"

End Select
End If
Next

Call UpdateToolbar
End Sub



Thanks,


---
Message posted from http://www.ExcelForum.com/



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.