Disabling Move for Userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Happy New Year to All!

Displayed userform can be moved around. Can this 'move' properties be
disabled using VBA?

Thanks.
 
Hi Francis,

Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu _
As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String _
, ByVal lpWindowName As String) As Long

Private Sub UserForm_Initialize()
RemoveMenu GetSystemMenu(FindWindow _
(vbNullString, Me.Caption), 0), 1, &H400
End Sub

MP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top