Adding frame on multipage through code...

G

Guest

I have couple of 100 templates and i need to make a global change to all
(Need to add a frame on 3rd tab of the multipage).

With the code below i am able to add frame on the form but could not figure
out how to add the same frame on the 3rd tab of the multipage.

Suggestions will be greaty appreciated.

Sub Add_Control_Testing(Wkb_Name As String, Form_Name As String)
' Declare variables.
Dim myForm As Object
Dim myFrame As Object
' to manipulate the UserForm.
Set myForm = Workbooks(Wkb_Name).VBProject.VBComponents.Item(Form_Name )

'Adding a frame
Set myFrame = myForm.Designer.Controls.Add("Forms.Frame.1")
With myFrame
.Name = "frame_1"
.Top = 180
.Left = 390
.Height = 60
.Width = 202
.BorderStyle = 1
End With
End Sub
 
G

Guest

I figured it out.
Sub Add_Control_Testing(Wkb_Name As String, Form_Name As String)
' Declare variables.
Dim myForm As Object
Dim myMultipage as Object
Dim myFrame As Object
' to manipulate the UserForm.

Set mynewform =
Workbooks(template_Name).VBProject.VBComponents.Item(module_Name)
Set myMultipage = mynewform.Designer.Controls.Item("Multipage1")

'Adding a frame to a multipage
Set myframe = myMultipage(3).Controls.Add("Forms.Frame.1")

With myframe
.Name = "frame_Ahf"
.Top = 350
.Left = 390
.Height = 60
.Width = 202
.BorderStyle = 1
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top