I'm utilizing vba forms instead of workbook, the workbook is visible=false. I have a command button to minimize excel which works fine. The issue is when I restore from the taskbar. Everything appears as it should except excel workbook shows up. How do I keep the workbook visible=false?
答案1
Is this the syntax you're using?
Windows("HideMe.xls").Visible = False
it would be useful to see the section of code it's nested in.
Edit:
Based on what you've told me, you could try putting this code into a new module. It will resize the workbook window to the specified dimensions. It will also hide it behind your userform rather than make it invisible, but this should also deal with the problem of it popping up on top of your userform which is the behavior, if I understand your problem correctly, you are trying to prevent.
Sub Show_Form()
Application.WindowState = xlNormal
Application.Left = 397
Application.Top = 136
Application.Width = 373.5
Application.Height = 435.75
DoEvents
UserForm1.Show
End Sub
Then add this to the userform's Terminate event:
Private Sub UserForm_Terminate()
Application.WindowState = xlMaximized
End Sub
You can obviously adjust the dimensions of the worksheet to hide them behind your userform.
If you are trying to make the worksheet invisible entirely from the user I think the only method that will work is the one I first posted, but that also makes it invisible from you, so that might not work either.