vba 最小化工作簿/工作表但保持表单打开
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40679441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Minimize workbook/sheet but keep form opened
提问by NoobProgrammer
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
and
和
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?
但这会隐藏所有活动的工作簿,工具栏功能区的东西也消失了。有没有办法最小化工作簿但同时保持功能区显示和表单打开?
回答by Mr.Burns
Tested on Excel 2010
在 Excel 2010 上测试
Sub Test()
ActiveWindow.WindowState = xlMinimized
UserForm1.Show
End Sub
This will minimize the all the workbooks in Excel but will keep the ribbon and any userforms visible, if you dont have Application.ScreenUpdating = Falsethen people will be able to see the workbooks in the bottom left of Excel.
这将最小化 Excel 中的所有工作簿,但会保持功能区和任何用户窗体可见,如果您没有,Application.ScreenUpdating = False那么人们将能够看到 Excel 左下角的工作簿。
If you want to just minimize a single workbook you can use the code below
如果您只想最小化单个工作簿,您可以使用下面的代码
Credit to this answer on SO for the minimizing specific workbooks
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
如果您需要澄清任何信息,请告诉我

