- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 2# C.F
¸Õ¸Õ¬Ý- Option Explicit
- Dim xeVBC As Object
- Private Sub Workbook_Open()
- Dim e As Object ' VBComponent
- Set xeVBC = Application.VBE.ActiveVBProject.VBComponents
- For Each e In xeVBC
- Debug.Print e.Name, e.Type '¼Ò²ÕªºType
- If e.Type <> 100 Then xeVBC.Remove e
- Next
- ¥[¤Jª«¥óÃþ§O¼Ò²Õ
- Report_Make_Form1
- End Sub
- Private Sub ¥[¤Jª«¥óÃþ§O¼Ò²Õ()
- With ThisWorkbook.VBProject.VBComponents.Add(2) 'vbext_ct_ClassModule
- .Name = "ClassTest"
- With .CodeModule
- .InsertLines 2, "Public WithEvents MyNewGoNextButton1 As MSForms.CommandButton"
- .InsertLines 3, "Private Sub MyNewGoNextButton1_Click()"
- .InsertLines 4, "With MyNewGoNextButton1.Parent.MultiPage_Step"
- .InsertLines 5, "If .Value = .Pages.Count - 1 Then"
- .InsertLines 6, ".Value = 0"
- .InsertLines 7, "Else"
- .InsertLines 8, ".Value = .Value + 1"
- .InsertLines 9, "End If"
- .InsertLines 10, "End With"
- .InsertLines 11, "End Sub"
- End With '
- End With
- End Sub
- Sub Report_Make_Form1()
- Dim MyNewForm3 As Variant, I
- 'Set MyNewForm3 = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm)
- Set MyNewForm3 = ThisWorkbook.VBProject.VBComponents.Add(3)
- '***********************************
- 'vbext_rk_Project ¤@¯ë¼Ò²Õ
- 'vbext_ct_ClassModule ª«¥óÃþ§O¼Ò²Õ
- 'vbext_ct_MSForm ªí³æ¼Ò²Õ
- '¦¹°Ñ¼Æªº±`¼Æ ¶·¦b [¤u¨ã] ¥\¯àªí¤Þ¥Î¶µ¥Ø¡C
- '¤Þ¥Î "Microsoft Visual Basic ªºÀ³¥Îµ{¦¡ÂX¥R"
- '***********************************
- Close #1
- Open "d:\MyNewForm.txt" For Append As #1
- Print #1, Now & " ¶}©l«Ø¥ß UserForm"
- Close #1
- ' Shell "notepad.exe d:\MyNewForm.txt", vbMaximizedFocus '****¶}±Ò¤å¦rÀÉ
- With MyNewForm3
- .Properties("Caption") = "Report_Generate"
- .Properties("Width") = 570
- .Properties("Height") = 350
- .Name = "Report_Generate_Form"
- With .Designer
- With .Controls.Add("forms.Multipage.1")
- .Name = "MultiPage_Step"
- .Left = 10
- .Top = 5
- .Height = 250
- .Width = 550
- .Font.Name = "Comic Sans MS"
- End With
- '¤§«á´N Multipage ¤¤ªº Page(0)¡BPage(1)¤¤·s¼W¤F¤@¨Ç±±¨î¶µ
- With .Controls.Add("forms.CommandButton.1")
- '«Ø¥ßÓ Button ¨Ó«ö¤@¨BÅý MultiPage ¨ì¤U¤@¶
- .Name = "GoNext_Btn"
- .Left = 280
- .Top = 258
- .Height = 50
- .Width = 70
- .Caption = "¤U¤@¨B"
- .Font.Name = "¼Ð·¢Åé"
- .Font.Size = 14
- End With
- End With
- ' Set Class_obj3(1).MyFormObject1 = MyNewForm3 '.Designer
- ' Set Class_obj3(2).MyMultiPage1 = MyNewForm3.Designer.Controls("MultiPage_Step")
- ' µM«á§Q¥Î Class ¤è¦¡°õ¦æ°Ê§@
- With .CodeModule
- .InsertLines 2, "Dim Class_obj As New ClassTest"
- .InsertLines 3, "Private Sub UserForm_Initialize()"
- .InsertLines 4, "Set Class_obj.MyNewGoNextButton1 = GoNext_Btn"
- .InsertLines 5, "End Sub"
- End With '
- End With
- End Sub
½Æ»s¥N½X |
|