+ Reply to Thread
Results 1 to 2 of 2

Adding frame on multipage through code...

  1. #1
    Ajit
    Guest

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

    --
    Ajit

  2. #2
    Ajit
    Guest

    RE: 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.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


    "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(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
    >
    > --
    > Ajit


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1