VBA Userform: Multipage Control Value Change

AFPathfinder

Well-known Member
Joined
Apr 8, 2012
Messages
533
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I'm having issues selecting another page using code where the page doesn't load. The page button gets visibly selected, but none of the controls on the selected page show; it still shows the page from my button page. To fix, the user needs to manually select another page.

I'm attempting to turn the last page on the multipage control into a command button since an actual command button can't be placed on top of the multipage tab/button row.

VBA Code:
Private Sub mpgAcctData_Change()
    'Keep track of the last selected tab when tab 7 (Search) is clicked.
    If mpgAcctData.Value <> 7 Then
        lblTabSniffer.Caption = mpgAcctData.Value
    End If

    'Dynamic userform height based on the currently active tab.
    Select Case mpgAcctData.Value
        Case 1          'FC tab.
            Me.Height = 244.5
            
        Case 4          'SC tab.
            Me.Height = 190.5
            
        Case 5          'SAG tab.
            Me.Height = 256.5
            
        Case 7          'Search tab.
            'Disable functionality until fully tested.
'            MsgBox "This functionality is still under construction.", vbInformation, "Coming Soon"
'            Exit Sub
            
            If mpgAcctData.tabSearch.Caption = " Search >> " Then
                mpgAcctData.tabSearch.Caption = " Search << "
                mpgAcctData.Value = IIf(lblTabSniffer.Caption = "", 0, lblTabSniffer.Caption)
                
                Load CodingBookSearch
                CodingBookSearch.Show
            Else
                mpgAcctData.tabSearch.Caption = " Search >> "
                mpgAcctData.Value = IIf(lblTabSniffer.Caption = "", 0, lblTabSniffer.Caption)
                
                On Error Resume Next
                Unload CodingBookSearch
                On Error GoTo 0
            End If
            
        Case Else       'OC, RCCC, PEC, and ESP tabs.
            Me.Height = 262.5
    End Select
End Sub

Any ideas?
 

Attachments

  • CB Userform.png
    CB Userform.png
    12.2 KB · Views: 44

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,808
Messages
6,181,072
Members
453,020
Latest member
mattg2448

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