I am trying to use WINGDING FOnts on some forms. I am not having full success with them. Sometimes they seem to work, other times not at all, and then sometimes if the code is less that 127...
HELP!!!!
I am programically creating the forms from a worksheet.
The code used to create is as follows:
VB:
Sub MakeUserForm()
Dim TempForm As Object
Dim NewButton As MSForms.commandbutton
Dim NewLabel As MSForms.Label
Dim NewTextBox As MSForms.TextBox
Dim NewOptionButton As MSForms.OptionButton
Dim NewCheckBox As MSForms.CheckBox
Dim x As Integer
Dim Line As Integer
Dim MyScript(4) As String
Dim BC As String
'This is to stop screen flashing while creating form
Application.VBE.MainWindow.Visible = False
Set TempForm = ThisWorkbook.VBProject.VBComponents.Add(3)
'Create the User Form
With TempForm
.Properties("Caption") = "BTS Check Screen"
.Properties("Width") = 750
.Properties("Height") = 800
.Properties("BackColor") = 15790320
End With
For x = 0 To lastrows()
If Trim(ActiveSheet.Cells(x + 2, 10).Value) = "" Then
Else
Set NewLabel = TempForm.designer.Controls.Add("Forms.label.1")
With NewLabel
BC = ActiveSheet.Cells(x + 2, 10).Value
.Name = ActiveSheet.Cells(x + 2, 1).Value
.Caption = ActiveSheet.Cells(x + 2, 2).Value
.Font.Name = ActiveSheet.Cells(x + 2, 3).Value
.Font.Size = ActiveSheet.Cells(x + 2, 4).Value
' ActiveSheet.Cells(x + 2, 5).Value
.Top = ActiveSheet.Cells(x + 2, 6).Value
.Left = ActiveSheet.Cells(x + 2, 7).Value
.Height = ActiveSheet.Cells(x + 2, 8).Value
.Width = ActiveSheet.Cells(x + 2, 9).Value
.BackColor = ActiveSheet.Cells(x + 2, 10).Value
.ForeColor = ActiveSheet.Cells(x + 2, 11).Value
.SpecialEffect = ActiveSheet.Cells(x + 2, 12).Value
.TextAlign = ActiveSheet.Cells(x + 2, 13).Value
End With
End If
Next
VBA.UserForms.Add(TempForm.Name).Show
End Sub
Function lastrows() As Long
With ActiveSheet.UsedRange
MyUsedRange = .Address
nUsedRows = .Rows.Count
LastRow = .Rows(nUsedRows).Row
End With
lastrows = LastRow
End Function
If you like these VB formatting tags please consider sponsoring me in support of injured Royal Marines
Attached is the structure worksheet
Reason I am using WINGDINGS is I want to use the TICK (code 252) and the "X" (code 251) for indicating if something is ordered or not.
The "click" code is as follows:
VB:
Private Sub v_acr_1_Click()
If v_acr_1.Caption = Chr(252) Then
v_acr_1.FontName = WingDings
v_acr_1.forecolor = 4210943
v_acr_1.Caption = Chr(251)
Else
v_acr_1.FontName = WingDings
v_acr_1.forecolor = 4210943
v_acr_1.Caption = Chr(252)
End If
End Sub
If you like these VB formatting tags please consider sponsoring me in support of injured Royal Marines