M
mevetts
Hi,
This post is primarily aimed at keepITcool, but please, anyone could
try to help me out!
The code for creating the command bar contained some face id values,
which I presume say what symbol to display on the bar? How can I find
what codes relate to what symbols? I've looked on the web, but can't
locate a key anywhere?
Also, can the code be altered so that on the 'Late' button it colours
the background of the cell as well? The reason being that I want to use
a tick for both the on time pupils and the late pupils, but highlight
the lates with a coloured background.
Here's the code -
Option Explicit
Sub BuildBar()
Const BARNAME = "TickMarks"
With Application
On Error Resume Next
..CommandBars(BARNAME).Delete
On Error GoTo 0
With .CommandBars.Add(BARNAME, msoBarTop, , True)
With .Controls.Add(, , 1, , True)
..Caption = "OnTime"
..FaceId = 1087
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
With .Controls.Add(, , 2, , True)
..Caption = "Absent"
..FaceId = 1088
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
With .Controls.Add(, , 3, , True)
..Caption = "Late"
..FaceId = 1089
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
..Visible = True
End With
End With
End Sub
Public Sub ButtonHandler()
Dim sWD$
sWD = Chr$(Choose(Application.CommandBars.ActionControl.Parameter, _
252, 251, 220))
With ActiveCell
..Font.Name = "Wingdings"
..Value = sWD
..Offset(1).Activate
End With
End Sub
Any help would be just brill!
Thanks,
Mark.
This post is primarily aimed at keepITcool, but please, anyone could
try to help me out!
The code for creating the command bar contained some face id values,
which I presume say what symbol to display on the bar? How can I find
what codes relate to what symbols? I've looked on the web, but can't
locate a key anywhere?
Also, can the code be altered so that on the 'Late' button it colours
the background of the cell as well? The reason being that I want to use
a tick for both the on time pupils and the late pupils, but highlight
the lates with a coloured background.
Here's the code -
Option Explicit
Sub BuildBar()
Const BARNAME = "TickMarks"
With Application
On Error Resume Next
..CommandBars(BARNAME).Delete
On Error GoTo 0
With .CommandBars.Add(BARNAME, msoBarTop, , True)
With .Controls.Add(, , 1, , True)
..Caption = "OnTime"
..FaceId = 1087
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
With .Controls.Add(, , 2, , True)
..Caption = "Absent"
..FaceId = 1088
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
With .Controls.Add(, , 3, , True)
..Caption = "Late"
..FaceId = 1089
..OnAction = ThisWorkbook.Name & "!buttonhandler"
End With
..Visible = True
End With
End With
End Sub
Public Sub ButtonHandler()
Dim sWD$
sWD = Chr$(Choose(Application.CommandBars.ActionControl.Parameter, _
252, 251, 220))
With ActiveCell
..Font.Name = "Wingdings"
..Value = sWD
..Offset(1).Activate
End With
End Sub
Any help would be just brill!
Thanks,
Mark.