开发者

How to hide Excel window from a user

开发者 https://www.devze.com 2022-12-17 02:39 出处:网络
Is there a way to hide Excel win开发者_如何转开发dows from a user - to prevent acidental closing it. If you are using OLE automation to control Excel, there is an Application.Visible property that sho

Is there a way to hide Excel win开发者_如何转开发dows from a user - to prevent acidental closing it.


If you are using OLE automation to control Excel, there is an Application.Visible property that should allow you to hide the window. I can't recall (offhad) whether this is totally hidden or just minimized. If you're in VBA, though, I can't come up with a solution.


I am not sure what the purpose is and how you intend to use but Application.Visible property can be useful. Alternatively you can add a warning message on Workbook_BeforeClose event

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If Not MsgBox("Do you want to really close this workbook?", vbOKCancel) Then
       Workbook_BeforeClose = False
    End If 
End Sub

Hope this helps... If you could be more elaborate then probably you will have exact solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号