wie kann ich die bildschirmgröße automatisch anpassen.
für antworten bin ich sehr dankbar.
gruß
ralf
Private Sub UserForm_Initialize()
'Userform wird auf die Größe von Excel gezoomt, wobei die
'die Controls entsprechend gezoomt und zentriert werden.
'Uwe Küstner 20070622
Dim Faktor As Single
Dim X As Single, Y As Single
Dim sngL As Single, sngO As Single, sngR As Single, sngU As Single
Dim oC As MSForms.Control
Faktor = Application.Height / (Me.Height - 20)
If Faktor 4 Then Faktor = 4
Me.Width = Application.Width
Me.Height = Application.Height
sngL = Me.Width
sngO = Me.Height
For Each oC In Me.Controls
sngL = Application.WorksheetFunction.Min(sngL, oC.Left)
sngO = Application.WorksheetFunction.Min(sngO, oC.Top)
sngR = Application.WorksheetFunction.Max(sngR, oC.Left + oC.Width)
sngU = Application.WorksheetFunction.Max(sngU, oC.Top + oC.Height)
Next oC
X = (Me.Width - (sngR * Faktor) - (sngL * Faktor)) / 2 / Faktor
Y = (Me.Height - (sngO * Faktor) - (sngU * Faktor) - 20) / 2 / Faktor
Me.Controls.Move X, Y
Me.Zoom = Faktor * 100
End Sub
Gruß Gerd