none
“The object invoked has disconnected from its clients ” by adding page in multipage RRS feed

  • Question

  • When I try to add page in Multipage 1 , it works but it doesnt work in multipage2 , they are together in a userform. Could someone tell me where the Problem is.

    My Code:
    Dim i As Integer

    Dim MyPage As Object

    Dim anzahl As Integer

    anzahl = CInt(TextBox12.value)

    If MultiPage1.Visible = True And ComboBox1.Text = Label2.Caption Then

    With MultiPage1

    For i = 1 To anzahl

    .Pages.Add

    .Pages(MultiPage1.Value).Controls.Copy

    Set MyPage = MultiPage1.Pages.Item(i)

    MyPage.Paste

    For Each ctl In MultiPage1.Pages(i).Controls

    Select Case TypeName(ctl) Case "TextBox"

    ctl.Text = ""

    End Select

    Next ctl

    Next i

    End With

    End If

    If MultiPage2.Visible = True And ComboBox1.Text = Label13.Caption Then

    With MultiPage2 For i = 1 To anzahl

    .Pages.Add

    .Pages(MultiPage2.Value).Controls.Copy

    Set MyPage = MultiPage2.Pages.Item(i)

    MyPage.Paste

    For Each ctl In MultiPage2.Pages(i).Controls

    Select Case TypeName(ctl)

    Case "TextBox" ctl.Text = ""

    End Select

    Next ctl

    Next i

    End With

    End If

    Thursday, September 5, 2019 11:30 AM