0

I have the following problem: I have a userform menu, from there I can navigate to other pages, and I want to create a "back button" for each page to return to the menu.

I tried to create this:

Private Sub btnback_Click()
Call back_menu(Actions)
End Sub

Sub back_menu(stage)  'Tried: stage As Object
    Unload stage
    Menu.Show
End Sub

Another example:

Sub next_page(from,to)
Unload from
to.show

This 1st is working now, but everytime I close the userform i got an error:

Run-type error'13' Type missmatch

I know I could write one by one or I could us the Unload Me, but I have other Functions where I would like to use this method to call the right userform.

Thanks in advance

1 Answer 1

1

Try using the hide method of the userform

Sub back_menu(stage as UserForm)  'Tried: stage As Object
    stage.hide
    Menu.Show
End Sub
Sub next_page(frmFrom as UserForm, frmTo as UserForm)
  frmFrom.hide
  frmTo.show
end Sub

You shoud avoid variable names that are code words as well --> like to in For i = 1 to 10.

Sign up to request clarification or add additional context in comments.

11 Comments

Thanks, this hide method is working. Can you suggest something for this: Sub next_page(from,to) Unload from to.show
ähhhmmm .... shouldn't be too hard to adjust this based on my example ....
Tried with this but with the 2 varriable the error occur... However it works.
I know I can't use "to" as varriable, it was just an example. I tried it and now it's not working and I got an other error: Run-type error'438' Object doesn't support this property or method
Are you really passing UserForms to the sub?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.