|
UO3さん、さっそくありがとうございます。
Private Sub UserForm_Initialize()
Dim p As Page
Dim sz As Double
Dim wk As String
Dim idx As Long
If Sheets("work").Range("A1").Value <> 1 Then
ken = kenn(): Sheets("hinnmei").Range("A1").Select
Else
Sheets("zaiko").Range("C65536").End(xlUp).Select
ken = ActiveCell.Row - 1
Sheets("zaiko").Select: Sheets("zaiko").Range("C2").Select
End If
With Me
.Height = 320
.Width = 420
End With
With Controls.Add("Forms.MultiPage.1")
.Top = 40
.Left = 5
.Height = 200
.Width = (9.75 * 40 + 12) + 0.75
.Pages.Remove 1
With .Font
.Name = "MS ゴシック"
.Size = 10
sz = Int(.Size / 0.75) * 0.75
End With
Set p = .Pages(0)
p.Caption = String(Int((Int(.Width / 0.75) * 0.75 - 12.75) / sz), " ")
wk = p.Caption
Mid(wk, 1, 80) = "--------------------------------------------------------------------------------"
p.Caption = wk
p.ScrollBars = 2
p.ScrollHeight = 5000
For idx = 1 To ken
Set c_lal(idx) = New Class1
With c_lal(idx)
.id = idx
Set .lal = p.Controls.Add("Forms.Label.1")
With .lal
.Top = (idx - 1) * 20 + 5
.Left = 30
.Width = 50
End With
End With
Set c_lbl(idx) = New Class1
With c_lbl(idx)
.id = idx
Set .lbl = p.Controls.Add("Forms.Label.1")
With .lbl
.Top = (idx - 1) * 20 + 5
.Left = 80
.Width = 230
End With
End With
Set c_txt(idx) = New Class1
With c_txt(idx)
.id = idx
Set .txt = p.Controls.Add("Forms.TextBox.1")
With .txt
.Top = (idx - 1) * 20 + 5
.Left = 280
.Width = 80
.TextAlign = fmTextAlignRight
End With
End With
Next
For idx = 1 To ken
p.Controls(3 * (idx - 1)).Caption = ActiveCell.Offset(idx - 1, 1).Value
p.Controls(3 * (idx - 1) + 1).Caption = ActiveCell.Offset(idx - 1, 2).Value
Next
End With
Set c_eve = New Class1
Set c_eve.p_obj = Me
End Sub
F8でステップごとに動かして行くと、
Set p = .Pages(0)
で
実行時エラー 13
型が一致しません
となります。
|
|