Pvaulter13
New Member
- Joined
- Nov 25, 2013
- Messages
- 10
I'm getting multipage in form to work very nicely, I press a button it adds a page, copies what's on that page and puts it in the new page. I've posted my code below, someone can probably use the Add delete functionality.
However, the problem arrives when you add an additional multipage on the same form. When you add multipage6 after multipage5 is there, Multipage 5 VBA code no longer works. I get an error code "the object invoked disconnect from client" or something similar.
Am I missing any code? What am I doing wrong? I've spend hrs on this, trying different tricks, moving code around, deleting & starting over.
Any help would be greatly appreciated-
Regards
Private Sub CommandButton9_Click()
Dim i As Integer
MultiPage5.Select (0)
MultiPage5.Pages.Add
i = MultiPage5.Count
MultiPage5.Pages(0).Controls.Copy
MultiPage5.Pages(i - 1).Paste
End Sub
Private Sub CommandButton10_Click()
Dim j As Long
j = MultiPage5.Pages.Count
If j = 1 Then
MsgBox ("Cannot delete this page")
Else
MultiPage5.Pages.Remove "Page" & j
End If
End Sub
Private Sub CommandButton11_Click()
Dim h As Integer
MultiPage6.Select (0)
MultiPage6.Pages.Add
h = MultiPage6.Count
MultiPage6.Pages(0).Controls.Copy
MultiPage6.Pages(h - 1).Paste
End Sub
Private Sub CommandButton12_Click()
Dim k As Long
k = MultiPage6.Pages.Count
If k = 1 Then
MsgBox ("Cannot delete this page")
Else
MultiPage5.Pages.Remove "Page" & k
End If
End Sub
However, the problem arrives when you add an additional multipage on the same form. When you add multipage6 after multipage5 is there, Multipage 5 VBA code no longer works. I get an error code "the object invoked disconnect from client" or something similar.
Am I missing any code? What am I doing wrong? I've spend hrs on this, trying different tricks, moving code around, deleting & starting over.
Any help would be greatly appreciated-
Regards
Private Sub CommandButton9_Click()
Dim i As Integer
MultiPage5.Select (0)
MultiPage5.Pages.Add
i = MultiPage5.Count
MultiPage5.Pages(0).Controls.Copy
MultiPage5.Pages(i - 1).Paste
End Sub
Private Sub CommandButton10_Click()
Dim j As Long
j = MultiPage5.Pages.Count
If j = 1 Then
MsgBox ("Cannot delete this page")
Else
MultiPage5.Pages.Remove "Page" & j
End If
End Sub
Private Sub CommandButton11_Click()
Dim h As Integer
MultiPage6.Select (0)
MultiPage6.Pages.Add
h = MultiPage6.Count
MultiPage6.Pages(0).Controls.Copy
MultiPage6.Pages(h - 1).Paste
End Sub
Private Sub CommandButton12_Click()
Dim k As Long
k = MultiPage6.Pages.Count
If k = 1 Then
MsgBox ("Cannot delete this page")
Else
MultiPage5.Pages.Remove "Page" & k
End If
End Sub