+ Reply to Thread
Results 1 to 18 of 18

Multipage bug?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Multipage bug?

    Hi everyone,

    I've got this piece of code that checks ListBoxes on different MultiPage tabs and asks confirmation from the user before continuing. However, if you don't want to continue it takes you back to the Page that has the missing info.

    Problem is, the Page displays blank on my PC without any of the controls. If I select another tab and then the first one again everything is fine.

    Any help would be appreciated. Thanks!

    Private Sub MultiPage1_Change()
    Dim Pg As MSForms.Page
    Dim PageControls As Object
    Dim num As Integer
    
        If MultiPage1.Value = 8 Then
            For Each Pg In MultiPage1.pages
                If Pg.Visible = True Then
                    For Each PageControls In Pg.Controls
                        If TypeName(PageControls) = "ListBox" Then
                            If PageControls.ListCount <= 1 Then
                                If MsgBox("Missing entries in: " + Pg.Caption + vbCrLf + vbCrLf + "Continue?", vbYesNoCancel) = vbYes Then
                                    Unload Me
                                    Value.Show
                                Else
                                    MultiPage1.Value = Pg.Index
                                    Exit Sub
                                End If
                            End If
                        End If
                    Next
                End If
            Next
        End If
    End Sub

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,947

    Re: Multipage bug?

    Welcome to the Forum Smurfi!

    This is just a guess; if you attach your file we could actually try it.
                                Else
                                    MultiPage1.Value = Pg.Index
                                    Me.Repaint
                                    Exit Sub
                                End If
    The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Hi Jazzer,

    Tried Repaint. Didn't work

    Tried Unloading and Re-loading the userform. Didn't work

  4. #4
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Here is the userform file. When clicking on the "Done" tab it executes the above mentioned code.
    Attached Files Attached Files

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Multipage bug?

    Could you upload workbook with the userform in it?
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    It's got some sensitive content sorry

  7. #7
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Just import the attachment in VBA

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,947

    Re: Multipage bug?

    I am able to reproduce the behavior but have not been able to find a cause. It does appear to correctly activate the button for page 0 (named Page 1) but it still shows the "Done" page (not Page1 with no controls) until you manually change pages. I confirmed this by adding a label to the "Done" page.

    I have not seen a control like this. I have used multipage controls using tabs, but not buttons. I suppose it is possible that there is a bug in the implementation.

  9. #9
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Unfortunately the same happens if the MultiPage style is set to Tabs. It seems that the code is also suspended in some way because if you choose the "Done" tab after the page index is set, the code is not executed

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Multipage bug?

    Smurfi

    I did import the attachment and when I tried the userform I got an error here.
    Value.Show
    What is 'Value'?

  11. #11
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Sorry Norie. Value is another userform. But that is not the problem. When prompted after clicking on "Done" select "No"

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,947

    Re: Multipage bug?

    I recommend against using Value as the name of anything you create. It is also the default attribute of many objects. VBA allows it, but it could create ambiguous code that may not resolve how you expect.

    It is not causing your problem, however.

  13. #13
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Thanks for the tip. It's an easy change as I haven't really started with that userform yet

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Multipage bug?

    Why not remove the sensitive data from the workbook and then upload it?

    That would make things a lot easier for us to help you.

  15. #15
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Here you go. Please treat with privacy

    Edit: Attachment removed
    Last edited by Smurfi; 09-05-2018 at 08:04 AM.

  16. #16
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,947

    Re: Multipage bug?

    Quote Originally Posted by Smurfi View Post
    Here you go. Please treat with privacy
    I did not see any private data in this file but please be aware than when you post here is it visible to anyone in this forum, which can be virtually anyone on the Internet.

  17. #17
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Multipage bug?

    It's a known bug, you can't change the page of a multipage in the multipage's change event

  18. #18
    Registered User
    Join Date
    07-09-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    10

    Re: Multipage bug?

    Hi Jazzer, I plan on removing it soon anyway.

    For anyone else coming here searching for a solution I used the following workaround. Instead of a message box for confirmation I used another Userform to ask for confirmation:
    Private Sub MultiPage1_Change()
    Dim Pg As MSForms.Page
    Dim PageControls As Object
    Dim num As Integer
    
        If MultiPage1.Value = 8 Then
            For Each Pg In MultiPage1.pages
                If Pg.Visible = True Then
                    For Each PageControls In Pg.Controls
                        If TypeName(PageControls) = "ListBox" Then
                            If PageControls.ListCount <= 1 Then
                                Continue.Label4.Caption = Pg.Index
                                Continue.Label2.Caption = Pg.Caption
                                Unload Me
                                Continue.Show vbModal
                                Exit Sub
                            End If
                        End If
                    Next
                End If
            Next
        End If
    End Sub
    and then the following code for the three Userform buttons "Yes", "No", "Cancel":
    Public PageInd As Integer
    
    Private Sub CommandButton1_Click()
    Unload Me
    Unload Estate
    EstateV.Show vbModal
    End Sub
    
    Private Sub CommandButton2_Click()
    Unload Me
    Estate.MultiPage1.Value = PageInd
    Estate.Show vbModal
    
    End Sub
    
    Private Sub CommandButton3_Click()
    Unload Me
    Estate.MultiPage1.Value = PageInd
    Estate.Show vbModal
    End Sub
    
    Private Sub UserForm_Activate()
    PageInd = CInt(Label4.Caption)
    End Sub
    Hope this helps someone else.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to switch multipage page from multipage change event??
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2015, 10:31 AM
  2. [SOLVED] ActiveControl - Return non-Multipage control when Form contains Multipage?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-04-2014, 08:37 PM
  3. multipage
    By walid66 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2007, 06:20 PM
  4. [SOLVED] MultiPage
    By OM in forum Excel General
    Replies: 3
    Last Post: 04-07-2006, 08:35 AM
  5. MultiPage
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2006, 04:25 PM
  6. MultiPage
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2006, 04:15 PM
  7. [SOLVED] How do I use multipage
    By Lawrence M Watt in forum Excel General
    Replies: 1
    Last Post: 10-24-2005, 10:05 AM

Tags for this Thread

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