Option Explicit
Sub ShowExpandingUserForm()
Load UserForm1
End Sub
Option Explicit
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, _
ByVal dwTime As Long, _
ByVal dwFlags As Long) As Boolean
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Const AW_CENTER = &H10
Const AW_ACTIVATE = &H20000
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
With UserForm1
.Top = 250
.Left = 250
End With
Dim lngFrmWindow As Long
lngFrmWindow = FindWindow("ThunderDFrame", "Userform1")
If lngFrmWindow <> 0 Then
AnimateWindow lngFrmWindow, 750, AW_CENTER Or AW_ACTIVATE
Me.Repaint
Else
Call MsgBox("There was an error when trying to animate the userform." _
& vbCrLf & "" _
, vbCritical, Application.Name)
End If
End Sub
|