Re: minimise workbook / display form on startup
For xl97 modeless forms are not available so to release the WorkbookOpen event DoEvents is needed.
Try like this: in WorkbookOpen
[vba]Private Sub Workbook_Open()
UserForm1.Show '(or whatever your userform is called)
End Sub[/vba]
in UserForm
[vba]Option Explicit
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
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 Long
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Sub UserForm_Initialize()
Dim hWnd As Long
Application.WindowState = xlMinimized
While hWnd = 0
DoEvents
hWnd = FindWindow(vbNullString, Me.Caption)
Wend
SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
SetForegroundWindow FindWindow("xlmain", Application.Caption)
End Sub
Private Sub UserForm_Terminate()
Application.WindowState = xlNormal
End Sub[/vba]