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 |
All times are GMT +1. The time now is 06:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com