|
一运行宏,就会在楷体加大部分显示“用户定义类型未定义”,不知如何处理?请大师出手帮一帮。谢谢!
四楼cflood 老师已经解决。
Private Sub UserForm_Initialize()
On Error Resume Next
MultiPage1.Value = 0
Dim Nodx As Node, RN, R, RX As Long
Set Me.TreeView1.ImageList = Me.ImageList1
Set Me.TreeView2.ImageList = Me.ImageList1
Set Me.TreeView3.ImageList = Me.ImageList1
Set Me.TreeView4.ImageList = Me.ImageList1
Set Me.TreeView5.ImageList = Me.ImageList1
With Sheets("凭证信息录入")
RN = .[N65536].End(xlUp).Row
Set Nodx = TreeView1.Nodes.Add(, , "会计科目", "资产类会计科目", 1, 2)
For R = 2 To RN
C1 = .Cells(R, 13)
C2 = .Cells(R, 15)
If Mid(.Cells(R, 13), 1, 1) = 1 Then
If ActiveSheet.Name = "凭证信息录入" Or 记账凭证.Visible = True Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView1.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView1.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView1.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
ElseIf ActiveSheet.Name = "明细分类账" And Mid(.Cells(R, 13), 1, 2) <> 10 Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView1.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView1.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView1.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
End If
Else
RX = R
Exit For
End If
Next
Set Nodx = TreeView2.Nodes.Add(, , "会计科目", "负债类会计科目", 1, 2)
For R = RX To RN
C1 = .Cells(R, 13)
C2 = .Cells(R, 15)
If Mid(.Cells(R, 13), 1, 1) = 2 Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView2.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView2.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView2.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
Else
RX = R
Exit For
End If
Next
Set Nodx = TreeView3.Nodes.Add(, , "会计科目", "所有者权益类会计科目", 1, 2)
For R = RX To RN
C1 = .Cells(R, 13)
C2 = .Cells(R, 15)
If Mid(.Cells(R, 13), 1, 1) = 3 Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView3.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView3.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView3.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
Else
RX = R
Exit For
End If
Next
Set Nodx = TreeView4.Nodes.Add(, , "会计科目", "成本类会计科目", 1, 2)
For R = RX To RN
C1 = .Cells(R, 13)
C2 = .Cells(R, 15)
If Mid(.Cells(R, 13), 1, 1) = 4 Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView4.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView4.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView4.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
Else
RX = R
Exit For
End If
Next
Set Nodx = TreeView5.Nodes.Add(, , "会计科目", "损益类会计科目", 1, 2)
For R = RX To RN
C1 = .Cells(R, 13)
C2 = .Cells(R, 15)
If Mid(.Cells(R, 13), 1, 1) = 5 Then
If Len(.Cells(R, 13)) = 4 Then
Set Nodx = TreeView5.Nodes.Add("会计科目", tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 6 Then
Set Nodx = TreeView5.Nodes.Add("A" & Left(C1, 4), tvwChild, "A" & C1, C2, 1, 2)
ElseIf Len(.Cells(R, 13)) = 8 Then
Set Nodx = TreeView5.Nodes.Add("A" & Left(C1, 6), tvwChild, "A" & C1, C2, 1, 2)
End If
Else
Exit For
End If
Next
End With
End Sub
请阅附件:
Book1.rar
(70.56 KB, 下载次数: 222)
[ 本帖最后由 JLF2003 于 2010-3-17 21:52 编辑 ] |
|