最小化工作簿/工作表,但保持表单打开 [英] Minimize workbook/sheet but keep form opened

查看:103
本文介绍了最小化工作簿/工作表,但保持表单打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以最小化工作簿/工作表,但可以使表单保持打开状态? 我已经尝试了代码:

Is there a way to minimize a workbook/sheet but able to keep the form opened up? I have tried the code:

application.visible=false

userform1.show vbmodeless

但是,这隐藏了所有活动的工作簿,工具栏功能区也消失了.有没有一种方法可以最小化工作簿,但还要同时显示功能区和表单?

But this hides the all active workbooks and the tool bar ribbon thing disappears as well. Is there a way to minimize the workbook but keep the ribbon showing and form opened as well?

推荐答案

在Excel 2010上测试

Sub Test()

    ActiveWindow.WindowState = xlMinimized
    UserForm1.Show

End Sub

这将最小化Excel中的所有工作簿,但将使功能区和任何用户窗体可见,如果您没有Application.ScreenUpdating = False,则人们将能够在Excel左下方看到工作簿.

This will minimize the all the workbooks in Excel but will keep the ribbon and any userforms visible, if you dont have Application.ScreenUpdating = False then people will be able to see the workbooks in the bottom left of Excel.

如果您只想最小化一个工作簿,则可以使用下面的代码

If you want to just minimize a single workbook you can use the code below

在SO上获得此答案的信用,以最大程度地减少特定工作簿

Sub test()

    Dim wbName As Window

    Set wbName = ActiveWorkbook.Windows(1)'You can use Windows("[Workbook Name]") as well

    wbName.Visible = False
    wbName.Visible = True

End Sub

让我知道您是否需要澄清的任何东西

Let me know if you need anything clarified

这篇关于最小化工作簿/工作表,但保持表单打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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