View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ajit Ajit is offline
external usenet poster
 
Posts: 64
Default 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