Results 1 to 2 of 2

Thread: Resizing the form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    I can resize the form, but how do I recenter the form on the screen once I do so?

    Thanks.

    -Git

  2. #2
    Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    53
    ' Centres a form either on the screen (default) or over another form
    Public Sub CentreForm(Optional varMoveForm As Variant, Optional varRefForm As Variant)

    Dim frmMoveForm As Form

    If IsMissing(varMoveForm) Or Not TypeOf varMoveForm Is Form Then
    Set frmMoveForm = Screen.ActiveForm
    Else
    Set frmMoveForm = varMoveForm
    End If

    With frmMoveForm
    If IsMissing(varRefForm) Or TypeOf varRefForm Is Screen Then
    .Move (Screen.Width - .Width) / 2, (Screen.Height - .Height) / 2
    ElseIf TypeOf varRefForm Is Form Then
    .Move varRefForm.Left + (varRefForm.Width - .Width) / 2, varRefForm.Top + (varRefForm.Height - .Height) / 2
    End If
    End With

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width