Multipage mouseover event to open "sub" multipages

rjchristensen

New Member
Joined
Jun 27, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello, I am trying to use multipage controls on a userform. I have created a series of multipages that go 3 to 4 levels down. I am trying to create a nested menu structure. When I run the form the multipages open the "sub" pages as when clicked. I want them to open using a mouseover event or something similar. Has anyone done this before? And, if so, how? Thanks!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi @rjchristensen
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

Something like this is what you want?




Review the following code.
There may be some adjustments to be made, but now you have something to start with and play with for a while.

VBA Code:
Sub setColor(lbl As MSForms.Label, mlt As Long, vle As Long)
  Dim ctrl As Object
  For Each ctrl In Controls
    If Left(ctrl.Name, 4) = "Page" Then
      ctrl.BackColor = &H8000000F
    End If
  Next
  Controls("MultiPage" & mlt).Value = vle
  lbl.BackColor = &HFF00&
End Sub

'***** Page 1 *****
Private Sub Page1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page1, 1, 0)
End Sub
Private Sub Page1_1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page1_1, 2, 0)
End Sub
Private Sub Page1_2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page1_2, 2, 1)
End Sub
Private Sub Page1_1_1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page1_1_1, 3, 0)
End Sub
Private Sub Page1_1_2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page1_1_2, 3, 1)
End Sub

'***** Page 2 *****
Private Sub Page2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page2, 1, 1)
End Sub
Private Sub Page2_1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page2_1, 4, 0)
End Sub
Private Sub Page2_2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page2_2, 4, 1)
End Sub
Private Sub Page2_1_1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page2_1_1, 5, 0)
End Sub
Private Sub Page2_1_2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  Call setColor(Page2_1_2, 5, 1)
End Sub

I share my test file.

--------------
Cordially
Dante Amor
--------------​
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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