1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Public Sub SurEcran2()
Dim kL1 As Double, kW1 As Double, kW12 As Double
If dllGetMonitors = 1 Then
Sheets("Feuil2").Select
ElseIf Application.Windows.Count > 1 Then
Application.Windows(2).Activate '--- change de fenêtre
Sheets("Feuil2").Select
Else
kW12 = dllGetHorizontalResolution '--- taille totale disponible --- voir code
Application.WindowState = xlMaximized '--- pour obtenir la taille de l'écran
kL1 = Application.Left
kW1 = Application.Width
'Debug.Print kL1, kW1, kW12
'--- crée la nouvelle fenêtre
ActiveWindow.NewWindow
Application.WindowState = xlNormal '--- pour permettre le déplacement
'--- place la nouvelle fenêtre à gauche ou à droite selon position fenêtre 1
If kL1 < 10 Then
Application.Left = kW1 + 20 '--- 20 arbitraire, juste pour ne pas être au bord
Else
Application.Left = 20
End If
Application.WindowState = xlMaximized
Sheets("Feuil2").Select
End If
End Sub |
Partager