3

I have a medical userform that a clinician will be using. There are several buttons to allow them to navigate to different forms. I'm currently using a Sub that does several checks to see if the forms are visible and if so, don't be. But that's not very friendly for adaptation.

Is there a call I can make to hide all currently open visible forms. Or, cycle through all currently opened forms (eg ones in memory) Request one is obviously the lazy one for me. Request two will be sufficient as I can do the code to hide them after that.

1 Answer 1

8

For potential google searches

This was the answer I needed. This will hide any open userforms.

Dim UForm As Object

For Each UForm In VBA.UserForms 

    If UForm.Visible = True Then
        UForm.Hide
    End If

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

1 Comment

I am using this to unload my user form and its working fine. I used If UForm.Visible = True Then UForm.unload End If

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.