Bonjour,
J'ai un bout de code qui me permet d'affiché les ScrollBars si mon USF est plus grand que ma résolution.
Pour la barre horizontale j'utilise :
If Application.Width < Me.Width Then
Me.Height = Me.Height + 11
Me.ScrollWidth = Me.Width - 5.5
Me.Width = Application.Width - 21
Me.ScrollBars = fmScrollBarsHorizontal
Me.KeepScrollBarsVisible = fmScrollBarsNone
End If
Verticale :
If Application.Height < Me.Height Then
Me.Width = Me.Width + 13
Me.ScrollHeight = Me.Height - 22.25
Me.Height = Application.Height - 13
Me.ScrollBars = fmScrollBarsVertical
Me.KeepScrollBarsVisible = fmScrollBarsNone
End If
Et la deux coté, j'utilise :
If Application.Height < Me.Height Then
Me.ScrollWidth = Me.Width - 5.5
Me.Width = Me.Width + 13
Me.Width = Application.Width - 21
Me.ScrollHeight = Me.Height - 22.25
Me.Height = Me.Height + 11
Me.Height = Application.Height - 13
Me.ScrollBars = fmScrollBarsBoth
Me.KeepScrollBarsVisible = fmScrollBarsNone
End If
J'ai environ 25 USF, le problème est que j'aimerai le mettre qu'une fois dans un module, dans les Initialize faire appel au code. Pour évité de l'avoir partout dans mon programme.
J'ai essayé de faire ceci, mais ça lui plait pas trop :
'Sub ScrollBarsOui(Usf As UserForm)
' If Application.Height < Usf.Height Then
' Usf.Width = Usf.Width + 13
' Usf.ScrollHeight = Usf.Height - 22.25
' Usf.Height = Application.Height - 13
' Usf.ScrollBars = fmScrollBarsVertical
' Usf.KeepScrollBarsVisible = fmScrollBarsNone
' End If
'End Sub
Vous avez une idée ?
Je joins un bout de fichier
Merci d'avance aux personnes participeront
A+