ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding frame on multipage through code... (https://www.excelbanter.com/excel-programming/320132-adding-frame-multipage-through-code.html)

Ajit

Adding frame on multipage through code...
 
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(Fo rm_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

--
Ajit

Ajit

Adding frame on multipage through code...
 
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.It em(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


"Ajit" wrote:

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(Fo rm_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

--
Ajit



All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com