前段时间,做了一个看板,利用EXCEL的窗体来设置的,由于是看板就需要全屏显示,找了半天就找到了如下代码,
如下是窗体全屏
Application.WindowState = xlMaximized With Me .Width = Application.Width .Height = Application.Height .Left = Application.Left .Top = Application.Top End With
另外可以设置窗体无边框显示,只是显示窗体
Private Declare Function DrawMenuBar Lib "user32" (ByVal Hwnd As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const GWL_STYLE As Long = (-16) Private Const GWL_EXSTYLE = (-20) Private Const WS_CAPTION As Long = &HC00000 Private Const WS_EX_DLGMODALFRAME = &H1& Private Sub UserForm_Initialize() '无边窗口开始 Dim IStyle As Long Dim Hwnd As Long If Val(Application.Version) < 9 Then Hwnd = FindWindow("ThunderXFrame", Me.Caption) Else Hwnd = FindWindow("ThunderDFrame", Me.Caption) End If IStyle = GetWindowLong(Hwnd, GWL_STYLE) IStyle = IStyle And Not WS_CAPTION SetWindowLong Hwnd, GWL_STYLE, IStyle DrawMenuBar Hwnd IStyle = GetWindowLong(Hwnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME SetWindowLong Hwnd, GWL_EXSTYLE, IStyle '无边窗口结束