avkokin said:
Hello.
I wonder, if there is a possibility to create own toolbar (panel) with
the icons of special symbols for quick insert they into document? I
want to have the possibility to add (and remove) on this toolbar
(panel) only those symbols which I need.
Thank you very much.
Hi avokin,
Good that you post this question in a VBA group... I think it's much easier
to create such a toolbar per macro than from the user interface.
Start the macro "Symbol_CreateToolbar" below to create the toolbar (or to
make it visible if it already exists).
Then, to add a symbol to the toolbar, select it in the text and click on the
"Add" button.
To remove symbols, you can simply drag them off the toolbar holding down the
ALT key.
In a short test, it seemed to work well with a wide variety of characters.
The tooltip (if you hover over a symbol button) shows you the font, and the
hex code.
If the button should not show the symbol, you'd have to edit its text by
hand (...say for spacing characters or other weird stuff).
Regards,
Klaus
Sub Symbol_CreateToolbar()
Dim myCBB As CommandBarButton
Dim strFont As String
Dim iSymbol As Long
Dim boolNew
boolNew = True
CommandBars.Add Name:="my Symbols"
CommandBars("my Symbols").Visible = True
For Each myCBB In CommandBars("my Symbols").Controls
If myCBB.Caption = "Add" Then
boolNew = False
End If
Next myCBB
If boolNew = True Then
Set myCBB = CommandBars("my Symbols").Controls.Add( _
Before:=1)
myCBB.Caption = "Add"
myCBB.TooltipText = "Click to add selected symbol to toolbar"
myCBB.Style = msoButtonCaption
myCBB.OnAction = "Symbol_Pickup"
End If
End Sub
Sub Symbol_PickUp()
Dim myCBB As CommandBarButton
Dim strFont As String
Dim iSymbol As Long
strFont = Selection.Font.Name
iSymbol = AscW(Selection.Text)
CommandBars.Add Name:="my Symbols"
CommandBars("my Symbols").Visible = True
Set myCBB = CommandBars("my Symbols").Controls.Add( _
Type:=msoControlButton, _
ID:=2290, _
Parameter:=ChrW(iSymbol) & strFont)
myCBB.Caption = ChrW(iSymbol)
myCBB.TooltipText = strFont & " " & Hex(iSymbol)
myCBB.Style = msoButtonCaption
End Sub