Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
dont see the Controls on the Forms generated at runtime
I have developed a VB6.0 exe which generated Excel templates. Each excel
template have two user forms. I want to add controls like List box, Combo box, Command Box and Text Boxes in these user forms through VB6.0 code. Now when the End User uses this template he can see these controls. I have also added the controls at runtime through VB 6.0 and save the Excel template. When I open the template I dont see the Controls on the Forms Please any one can guide me how to do this from VB 6.0 and would we a great help if some provide me with the code |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
don't see the Controls on the Forms generated at runtime
Controls added to Userforms at runtime do not persist. If you want to
programmatically create your form and add controls that can be saved with the workbook, append your reference to the form with .Designer, eg Sub test() Dim wb As Excel.Workbook Dim vbCmp As Object 'VBIDE.VBComponent with ref to VBA extensibility Dim ctl As Object Set wb = Application.Workbooks.Add Set vbCmp = wb.VBProject.VBComponents.Add(3) ' vbext_ct_MSForm With vbCmp.Designer Set ctl = .Controls.Add("Forms.CommandButton.1") With ctl .Left = 20 .Top = 10 .Caption = "Hello" End With End With End Sub Above of course is Excel/VBA, change 'Application' to your VB6 ref to Excel, eg xlApp. Presumably you will want to add code to the form as well. Unless you need to redesign the form according to latest needs, I would have thought easier to save a pre-made form to file, distribute the .frm & .frx and simply import the .frm. to the vbProject Regards, Peter T "Abhishake Saravgi" wrote in message ... I have developed a VB6.0 exe which generated Excel templates. Each excel template have two user forms. I want to add controls like List box, Combo box, Command Box and Text Boxes in these user forms through VB6.0 code. Now when the End User uses this template he can see these controls. I have also added the controls at runtime through VB 6.0 and save the Excel template. When I open the template I don't see the Controls on the Forms Please any one can guide me how to do this from VB 6.0 and would we a great help if some provide me with the code |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Events on controls generated on the fly... | Excel Programming | |||
TRICKY: runtime generated comboboxes and change event | Excel Programming | |||
TRICKY: runtime generated comboboxes and change event | Excel Programming | |||
User forms that are generated at runtime | Excel Programming | |||
Don´t show Updatelinks prompt and don´t update | Excel Programming |