1 Attachment(s)
Position modeless userform to top right of Activewindow
Working on a 'Wizard' form (below is just some test code as a proof of concept)
I'd like the modeless UF to align top right of the active pane, but can't get the .Top's and .Left's and .Width's to work out reliably in the UserForm_Activate
The screen shot show what I'm trying to achieve (it was manually positioned since I can't get the code the right)
I'd like to set the height to the same as the ActiveWindow also
Code:
Option ExplicitPrivate Sub CommandButton1_Click()
ActiveSheet.Range("A1").Value = Format(Now, "long date") & " - " & Format(Now, "long time")
End Sub
Private Sub CommandButton2_Click()
Load ufData
ufData.Show (vbModal)
End Sub
Private Sub CommandButton3_Click()
ActiveSheet.Range("A2").Value = 123
End Sub
Private Sub CommandButton4_Click()
Me.Hide
Unload Me
End Sub
Private Sub UserForm_Activate()
Me.StartUpPosition = 0
Me.Top = -Application.Top - ActiveWindow.Top
Me.Left = -ActiveWindow.Left + ActiveWindow.Width - Me.Width
End Sub
Paul