例如:
sub auto_open()
formname.show 1
end sub
如果是谨余fromname.show 0 或者formname.show则窗体不会强制在最前面
如果想只显示窗体,EXCEL隐藏,则可通过下面语句可以前裂设置EXCEL为不可见,只显示窗祥悔滚体:
private sub From_Load()
application.visible=false
end sub
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Const HWND_TOP&= 0
Private Const HWND_BOTTOM&= 1
Private Const HWND_TOPMOST&= -1
Private Const HWND_NOTOPMOST&= -2
' 将窗口置于列让唤没表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE&= &H1
' 保持窗口大坦纳小
Private Const SWP_NOMOVE&= &H2
' 保持窗口位置
Private Sub TOPMOST()
' 将窗口设为总在最前链迹
SetWindowPos Application.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub NOTOPMOST()
' 取消窗口总在最前
SetWindowPos Application.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)