Mulipage (userform1) Contents Not Changinging When Userform Commandbutton (userform2) calls Multipage value change

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,570
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a userform in which I have a multipage control with three pages. Of the three pages, the first page (value=0) is considered my "default".

The user can step through the pages in any order and everything behaves as expected. The page changes are controlled with the multipage_change event

When the user selects either the second or third tab (page), a second userform (uf9c_idate) opens allowing the user to enter some additional information. The user may opt out of this by pressing a commandbutton control (cancel). With pressing this button, the userform is closed, and the multipage control's value is set to 0 to return the multipage to the default page.

Code:
Private Sub uf9c_cancel_Click()
    'Debug.Print uf9_poststaff.MultiPage1.Value
    'Debug.Print mbEvents
    'mbEvents = False
    uf9_poststaff.MultiPage1.Value = 0
    Unload uf9c_idate
End Sub

What ends up happening is the tab changes, but the default page's contents do not change appropriately. The contents remain that of the controls from the page the user had selected previously.

I had originally posted this here , where I was advised that this behavior may be due to a bug. But I'm unsure if this is the "bug" that is creating my problem. The reference that was shared with me, as well as similar google searches, reveal the problem may be caused from user input on the other pages. In my case, I am getting incorrect behavior from code being run from a control on a separate userform, rather than switching pages from within the multipage control.

I'm wondering if anyone might be so kind as to review my code to see if I am encountering a similar behavior as suggested, or I have faulty code? If this is a situation that is not recoverable by means of how I hope, can anyone suggest an alternative method? Ideally, I really need the user to be returned to the contents of the default page of the multipage control.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Can you post a simplified version of the code that produces the problem you are experiencing ?
 
Upvote 0
When the user selects either the second or third tab (page), a second userform (uf9c_idate) opens ... The user may opt out of this by pressing a commandbutton control (cancel). With pressing this button, the userform is closed, and the multipage control's value is set to 0 to return the multipage to the default page.

I had originally posted this here , where I was advised that this behavior may be due to a bug. But I'm unsure if this is the "bug" that is creating my problem. The reference that was shared with me, as well as similar google searches, reveal the problem may be caused from user input on the other pages. In my case, I am getting incorrect behavior from code being run from a control on a separate userform, rather than switching pages from within the multipage control.

It sounds exactly like that bug to me. Your Change event on the first form's Multipage is loading the second form and you are then trying to change the original multipage's page, so yes, effectively you are trying to change the page from the page's Change event.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top