| Ozgrid Excel Help Forums & Excel Best Practices |
I am trying to keep my form fixed (the user cannot move it around) is this possible? how?
thanks in advance
Hi,
Here a non API way to keep the userform in the same position as when activated.
Add this to the userform code module.
Code:Option Explicit Private m_sngAnchorLeft As Single Private m_sngAnchorTop As Single Private m_blnSetAnchor As Boolean Private Sub UserForm_Activate() If Me.Visible Then If Not m_blnSetAnchor Then m_sngAnchorLeft = Me.Left m_sngAnchorTop = Me.Top m_blnSetAnchor = True End If End If End Sub Private Sub UserForm_Deactivate() m_blnSetAnchor = False End Sub Private Sub UserForm_Layout() If m_blnSetAnchor Then Me.Left = m_sngAnchorLeft Me.Top = m_sngAnchorTop End If End Sub
Cheers
Andy
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks