Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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
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
Events on controls generated on the fly... ste Excel Programming 1 September 1st 06 07:41 PM
TRICKY: runtime generated comboboxes and change event Goppi[_4_] Excel Programming 1 October 28th 04 04:49 PM
TRICKY: runtime generated comboboxes and change event Goppi[_7_] Excel Programming 0 October 28th 04 02:41 PM
User forms that are generated at runtime mike888 Excel Programming 7 October 15th 04 01:48 PM
Don´t show Updatelinks prompt and don´t update Kent Excel Programming 4 August 26th 04 05:50 PM


All times are GMT +1. The time now is 04:17 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"