View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron[_2_] Michel Pierron[_2_] is offline
external usenet poster
 
Posts: 63
Default Lock userform position

Re Newbie,
Or if you prefer (to envisage a button to close the userform):
Private Declare Function FindWindowA& Lib "User32" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLongA& Lib "User32" _
(ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)

' Necessary button to close userform
Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Left = 50: Me.Top = 90
Dim hWnd As Long, exLong As Long
hWnd = FindWindowA(vbNullString, Me.Caption)
SetWindowLongA hWnd, -16, &H84400080
End Sub

MP


"Newbie" a écrit dans le message de
...
Is it possible to lock the position of a userform to prevent users from dragging

it around the screen?