|
以下のフォームのイベントプロシジャーだけ差しかえてください
'======================================
Private Sub UserForm_Initialize()
chkcnt = Application.InputBox("チェックボックスの数を入力", , , , , , , 1)
If TypeName(chkcnt) <> "Boolean" Then
If chkcnt > 0 Then
ReDim chkbx(1 To chkcnt)
With Controls.Add("Forms.Frame.1", "Frame1")
.Top = 10
.Left = 30
.Height = 280
.Width = 250
.ScrollBars = 2
For idx = 1 To chkcnt
Set chkbx(idx) = .Controls.Add("Forms.CheckBox.1")
With chkbx(idx)
.Top = (idx - 1) * 50 + 10
.Left = 15
.Height = 16
.Font.Name = "MS ゴシック"
.Font.Size = 16
.Caption = "チェックボックス" & idx
.AutoSize = True
End With
Next idx
.ScrollHeight = chkcnt * 50 + 30
End With
Set btn = Controls.Add("Forms.CommandButton.1")
With btn
.Top = 10
.Left = 300
.Width = 50
.Height = 30
.Caption = "スクロール"
End With
With Me
.Width = 400
.Height = 350
End With
End If
End If
End Sub
|
|