将新标签页复制并粘贴到MSForms.Page中

时间:2012-04-18 17:41:10

标签: excel vba multipage

我在带有MultiPage对象的Excel中有一个UserForm。我需要通过复制和粘贴其中一个现有标签页,动态地向MultiPage对象添加更多标签页。 任何帮助将不胜感激。

谢谢

1 个答案:

答案 0 :(得分:2)

您可以使用这段代码

来完成此操作
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

<强>快照

enter image description here

相关问题