, . Debug Print … With.Import : " VBE 1st VBComponents, . .
Sub test()
Dim FName As String
With ThisWorkbook.VBProject.VBComponents ' save UserForm1
Debug.Print "UserForm1 has " & .Item("UserForm1").Properties.Count & " properties before"
With .Item("UserForm1")
'Debug.Print "UserForm1 has " & .Properties.Count & " properties"
FName = Environ$("Temp") & "\" & .Name & ".frm"
If (LenB(Dir(FName)) <> 0) Then
Kill FName
End If
.Export Filename:=FName ' rename Form
.Name = .Name & "_org"
End With ' import
With .Import(FName)
'Debug.Print FName & " has " & .Properties.Count & " properties"
End With
Debug.Print "Userform_org has " & .Item("UserForm1_org").Properties.Count & " properties"
End With
End Sub
. userform1s . , , Userform1 . . Excel 2007. , - VBE.
Edit2: , . Activate . Activate VBComponent, . . Vbc.Activate , , Vbc.Activate excel, userForms , .
Dim Vbc As VBComponent
For Each Vbc In ThisWorkbook.VBProject.VBComponents
If Vbc.Type <> 100 Then ‘ to exclude worksheets
Vbc.Activate ‘ Try with or Without this line
Debug.Print Vbc.Name & " has " & Vbc.Properties.Count & " Properties"
End If
Next Vbc