Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding checkbox within a frame
I have couple of 100 templates and inorder to make a global change (Adding a
frame and a checkbox on form) to all of them, i was trying the below mentioned code. What i was doing was opening each template at time..making the design time change and saving it before closing. Problem : It adds the frame and then the checkbox on the form. But i want to add the checkbox in the frame. Any ideas!... Sub Add_Control() ' Declare variables. Dim mynewform As Object Dim myframe As Object Dim mycheckbox As Object ' to manipulate the UserForm. Set mynewform = Workbooks(workbook_Name).VBProject.VBComponents.It em(form_Name) 'Adding a frame Set myframe = mynewform.Designer.Controls.Add("Forms.Frame.1") With myframe .Name = "frame1" .Top = 180 .Left = 390 .Height = 60 .Width = 202 .BorderStyle = 1 End With 'Add a checkbox. Set mycheckbox = mynewform.Designer.Controls.Add("Forms.checkBox.1" ) With mycheckbox .Name = "chk_1" .Top = 6 .Left = 6 .Height = 14.25 .Width = 198 End With End Sub -- Ajit |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding checkbox within a frame
Ajit,
Try changing Set mycheckbox = mynewform.Designer.Controls.Add("Forms.checkBox.1" ) to Set mycheckbox = myframe.Designer.Controls.Add("Forms.checkBox.1") so that you are adding the control to the frame, not the form. HTH, Bernie MS Excel MVP "Ajit" wrote in message ... I have couple of 100 templates and inorder to make a global change (Adding a frame and a checkbox on form) to all of them, i was trying the below mentioned code. What i was doing was opening each template at time..making the design time change and saving it before closing. Problem : It adds the frame and then the checkbox on the form. But i want to add the checkbox in the frame. Any ideas!... Sub Add_Control() ' Declare variables. Dim mynewform As Object Dim myframe As Object Dim mycheckbox As Object ' to manipulate the UserForm. Set mynewform = Workbooks(workbook_Name).VBProject.VBComponents.It em(form_Name) 'Adding a frame Set myframe = mynewform.Designer.Controls.Add("Forms.Frame.1") With myframe .Name = "frame1" .Top = 180 .Left = 390 .Height = 60 .Width = 202 .BorderStyle = 1 End With 'Add a checkbox. Set mycheckbox = mynewform.Designer.Controls.Add("Forms.checkBox.1" ) With mycheckbox .Name = "chk_1" .Top = 6 .Left = 6 .Height = 14.25 .Width = 198 End With End Sub -- Ajit |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamically Adding Textbox To Frame | Excel Worksheet Functions | |||
adding a checkbox | Excel Discussion (Misc queries) | |||
Adding a Checkbox in Cells | Excel Discussion (Misc queries) | |||
How to attach legend frame to chart frame? | Charts and Charting in Excel | |||
Problem in adding item to a checkbox | Excel Programming |