Approach by marking page captions by a checkmark
"Or do you have any idea so that the active tab can appear better against the inactive tabs?" -
A possible & helpful approach would be to
- mark each clicked page caption by a checkmark (e.g.
ChrW(&H2611)
) and to
- automatically de-mark a prior page caption: the code "remembers" the current/old page index via the multipage's
.Tag
property set at any multipage ..._Change()
event (.Tag
gets initialized via UserForm_Initialize()
firstly).
As Captions may include normal blanks, I chose to add a protected blank (ChrW(&HA0)
) to the checkmark character to allow a simple Replace()
maintaining the blanks in the original page caption.
Example code in Userform
Private Sub MultiPage1_Change()
'Purpose: mark current page caption by a checkmark
With Me.MultiPage1
Dim pg As MSForms.Page
'a) de-mark old caption
Set pg = oldPage(Me.MultiPage1)
pg.Caption = Replace(pg.Caption, ChkMark, vbNullString)
'b) mark new caption & remember latest multipage value
Set pg = .Pages(.Value)
pg.Caption = ChkMark & pg.Caption
.Tag = .Value ' << remember latest page index
End With
End Sub
Help functions & UserForm_Initialize()
routine
Function oldPage(mp As MSForms.MultiPage) As MSForms.Page
'Purpose: return currently marked page in given multipage
With mp
Set oldPage = .Pages(Val(.Tag))
End With
End Function
Function ChkMark() As String
'Purpose: return ballot box with check + blank space
ChkMark = ChrW(&H2611) & ChrW(&HA0) ' ballot box with check + blank
End Function
Private Sub UserForm_Initialize()
'Purpose: mark start page & remember page index
Const startIndx As Long = 0
With Me.MultiPage1
.Pages(startIndx).Caption = ChkMark & .Pages(startIndx).Caption
.Tag = startIndx
End With
End Sub
