Good afternoon jlroper
It can be done, but only through using Windows API calls. It also makes a difference what version of Excel you are using, but the code below should handle this for you. Put this code in your main module:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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
Sub HideX(UForm As Object)
Dim Win As Long, WinStyle As Long
If Val(Application.Version) >= 9 Then
Win = FindWindow("ThunderDFrame", UForm.Caption)
Else
Win = FindWindow("ThunderXFrame", UForm.Caption)
End If
WinStyle = GetWindowLong(Win, -16)
SetWindowLong Win, -16, WinStyle And Not &H80000
End Sub
Sub DisplayForm()
UserForm1.Show
End Sub
and in your userform module put this in your initialization routine:
HideX UserForm1
Just remember to include a button in there for the user to cancel...!
HTH
DominicB
Bookmarks