小编Har*_*orn的帖子

"<应用程序定义或对象定义的错误>错误1004"

我有一个简单的for-next来填充用户表单上的一些标签,但无法弄清楚为什么一直得到"错误1004"当我输入Contr.Caption时,.Caption函数丢失了?

Dim Control_Name As String
Dim DSlot As Long
Dim DLName As Long
Dim Contr As Control

With Worksheets("apartments").Range("depositslot")
    DSlot = .Find("Slot").Row + 1
    DLName = .Find("Last").Column
End With

For Each Contr In Layout.Controls
    If TypeName(Contr) = "Label" Then
        Control_Name = Mid(Contr.Name, 1, 6)
            If Control_Name = "LBName" Then
                Contr.Caption = Worksheets("apartments").Range(DSlot, DLName).Value
                DSlot = DSlot + 1
            End If
    End If
Next
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

1
推荐指数
1
解决办法
50
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1