Excel VBA隐藏所有打开的用户表单 [英] Excel VBA Hide all opened userforms

查看:816
本文介绍了Excel VBA隐藏所有打开的用户表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个临床医生会使用的医疗用户表格。有几个按钮允许他们导航到不同的形式。我目前正在使用一个Sub做一些检查,看看表单是否可见,如果是,请不要。但这不适合适应。



是否有一个电话可以隐藏所有当前打开的可见表单。或者,循环所有当前打开的表单(例如内存中的表单)请求一个显然是我的懒惰。请求两个将足够,因为我可以在之后隐藏他们的代码。

解决方案

对于潜在的Google搜索



这是我需要的答案。这将隐藏任何打开的用户形式。

  Dim UForm As Object 

对于VBA.UserForms中的每个UForm

如果UForm.Visible = True然后
UForm.Hide
结束如果

下一个


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.

解决方案

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

这篇关于Excel VBA隐藏所有打开的用户表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆