Fred
Fred

Reputation: 378

Copy and paste a new tab page into MSForms.Page

I have a UserForm in Excel with MultiPage object. I need to add more tab pages into the MultiPage object dynamically, by copying and pasting one of the existing tab pages. Any help would be appreciated.

Thank you

Upvotes: 2

Views: 684

Answers (1)

Siddharth Rout
Siddharth Rout

Reputation: 149335

You can do this by using this piece of code

Option Explicit

Private Sub CommandButton1_Click()

    '~~> Change 1 to the respective page index which you want to replicate
    MultiPage1.Pages(1).Controls.Copy

    '~~> Add a New page
    MultiPage1.Pages.Add

    '~~> Paste the copied controls
    MultiPage1.Pages(MultiPage1.Pages.Count - 1).Paste

End Sub

SNAPSHOT

enter image description here

Upvotes: 2

Related Questions