Using Command Buttons on Multipage Userform

bisel

Board Regular
Joined
Jan 4, 2010
Messages
223
Office Version
  1. 365
Platform
  1. Windows
Hello All,

I have a complex workbook with an userform that I call the "control panel". This userform contains various aids for data entry. The form as multiple pages that correspond to data fields on several of the worksheets in the workbook.

I have been performing some minor changes ... mostly cosmetic. In the latest iteration of making some updates the command buttons on the userform pages other than the home page, have stopped working. Not entirely actually, but now when the user clicks the command button, instead of running the macro, once clicked, the userform immediately opens the home page of the userform and the macro quits. If I go back to the page by clicking on the page tab and click the command button again, it then will run the macro as expected.

Does anyone have any ideas on what may have happened here. I did not change the macro nor the layout on the userform.

Here are some images of what is happening ...

Here is the user form when first opened ... defaults to Page 0

1589984277741.png


I click on "User Controls" button to go to this page ...

1589984303354.png


I have several command buttons. When I click on any of them, the userform immediately reverts to another page. In this case (buttons on this page), it reverts back to the home page. If I re-open the User Controls page and click on a command button, then it does what is expected.

Using the "Refresh Worksheets" command button as an example, here is the code associated with that command button ...

VBA Code:
Private Sub refreshbutton_Click()


    msg = Sheet5.Range("data_refresh_message_text").Value
            Style = vbOKCancel + vbDefaultButton2
            Title = "Data Refresh"
            response = MsgBox(msg, Style, Title)

If response = vbCancel Then Exit Sub

Application.Run ("refresh_worksheets")

End Sub

Here are the properties for the page in question ...

1589984558306.png


And here are properties for the base user form ...

1589984816104.png


I am stumped.

Steve
 

Attachments

  • 1589984150094.png
    1589984150094.png
    162.9 KB · Views: 8
  • 1589984249716.png
    1589984249716.png
    197 KB · Views: 6
  • 1589984731341.png
    1589984731341.png
    53.2 KB · Views: 5
  • 1589984794057.png
    1589984794057.png
    53.2 KB · Views: 4

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
If your updates have failed, Are you not able to go back to an earlier revision?

Dave
 
Upvote 0
If your updates have failed, Are you not able to go back to an earlier revision?

Dave

Going back to prior version is a solution, but would have to re-do all the changes. Trying to avoid that. Hoping someone has seen this behavior and may have a solution short of going backwards.

Thanks,

Steve
 
Upvote 0
If your project is as complex as you describe, I rather suspect issue likely to be something you have done rather than a behavioural issue with the objects you are using but I could be wrong - always helpful if you can place copy of your workbook (with sensitive data removed) in a dropbox & provide link to it.

Plenty here to have a look & maybe, spot the problem

Dave
 
Upvote 0
I went back to last good working copy of the workbook. I made the incremental changes and saved my work as I went along ... ending up with several incremental copies.

Got to the end of the changes and all is working well. Made a copy of that version and started testing the copy.

Everything going pretty good. Then made a change to an embedded picture on the userform that is my splash screen, saved my work and then opened the workbook. Bang! Got a Path/File Access Error when I opened the workbook which at workbook open shows a userform that I use for a splash screen. When I close the error message, Excel then quits. When I re-open the workbook, virtually all of my VBA code does not run.

At least this time, I went to the last working copy (which had all my changes) and I am able to get things back. But, when I made that change to the picture on the user form, same issue.

Something is going on that is corrupting the workbook. I will be doing some trial and error troubleshooting.

Steve
 
Upvote 0
At least issue helped you think about making revisional step changes to your project & can now recover quickly from any updates that fail.

Good luck with resolving the main issue you have but can always post to the forum if further help needed



Dave
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,461
Members
449,085
Latest member
ExcelError

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