Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pablo via OfficeKB.com
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
close form code tkaplan Excel Discussion (Misc queries) 1 June 3rd 05 10:49 PM
User Form Code mully New Users to Excel 9 May 22nd 05 07:54 PM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
How can I have information from a form I created to automatically. group3 Excel Discussion (Misc queries) 1 December 29th 04 05:42 PM


All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"