I have a userform keyboard named (UFKeyboard). In this form there are 3 frames, Frame1, Frame2, and Frame3, each containing a separate keyboard. When one keyboard is called the other 2 frames are hidden. All 3 keyboards are different sizes though so what I'm trying to do is find a way to adjust the size of the userform to match the size of the visible keyboard. That way when the numberpad keyboard shows there's not a large grey box covering most of the screen. Not to sure where to start searching for this one. Here's my current initialize:
Thanks,
Jordan
Code:
Private Sub UserForm_Initialize()
Dim strBox As String
Dim i As Integer
Dim varFrame As Variant, varLabel As Variant
Dim clsBtnKey As clsBtnKeys
Dim ctlLoop As MSForms.Control
Set colKeyboardKeys = New Collection
For i = 1 To 3
varFrame = Me("Frame" & i)
Select Case i
Case Is = 1, Is = 2, Is = 3
For Each ctlLoop In Me("Frame" & i).Controls
If TypeOf ctlLoop Is MSForms.commandbutton Then
Set clsBtnKey = New clsBtnKeys
Set clsBtnKey.Control = ctlLoop
colKeyboardKeys.Add clsBtnKey
End If
Next ctlLoop
For Each ctlLoop In Me("Frame" & i).Controls
If TypeOf ctlLoop Is MSForms.commandbutton Then
ctlLoop.Caption = Left(ctlLoop.Tag, 1)
End If
Next ctlLoop
cbnBackSpace.Caption = "Backspace"
cbnEnter.Caption = "Enter"
cbnBackspaceB.Caption = "Backspace"
cbnEnterB.Caption = "Enter"
cbnBackSpaceC.Caption = "Backspace"
cbnEnterC.Caption = "Enter"
TextBox1.SetFocus
Case Else: Exit For
End Select
Next
' Fetch label caption for textbox2 on UFKeyboard
' strBox = Mid(UserFormContacts.ActiveControl.Name, 8)
' varLabel = "Label" & strBox
' UFKeyboard.TextBox2.Value = UserFormContacts(varLabel).Caption
End Sub
Thanks,
Jordan
Last edited: