Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Add code to a excel's form created by program (Vb .Net)
How can I to add code to a Microsoft Excel's form created by program?
I try with : VBCompForm = oExcel.ActiveWorkbook.VBProject.VBComponents.Add(V BIDE. vbext_ComponentType.vbext_ct_MSForm) VBCompForm.Name = "New_Frm" Dim VBCodeMod_Frm As VBIDE.Components Dim linea_frm As Long VBCodeMod_frm = oBook.vbproject.vbcomponents("New_Frm").codemodule With VBCodeMod_frm linea_frm = .CountOfLines + 1 .InsertLines(linea_frm, _ "Private Sub UserForm_Activate()" & Chr(13) + Chr(13) & _ "'Boton Aceptar" & Chr(13) & _ "loCmd1 = Me.Controls.Add(""Forms.Commandbutton.1"", BtnOk, Visible)" & Chr(13) & _ "With loCmd1" & Chr(13) & _ " .Left = 90" & Chr(13) & Chr(13) & _ " .Top = 125" & Chr(13) & _ " .Width = 50" & Chr(13) & _ " .Height = 20" & Chr(13) & _ " .Caption = ""Aceptar""" & Chr(13) & _ "End With" + Chr(13) + Chr(13) & _ .... but it does not work. -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
close form code | Excel Discussion (Misc queries) | |||
User Form Code | New Users to Excel | |||
Make Change Case in Excel a format rather than formula | Excel Worksheet Functions | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
How can I have information from a form I created to automatically. | Excel Discussion (Misc queries) |