bonjour
petit problème pour trouver la macro qui me fera le résultat suivant :
j'aimerais lancer mon userform en plein écran sans masquer la barre des taches.
auriez vous une solution à mon problème?
Grand merci à vous !
bonjour
petit problème pour trouver la macro qui me fera le résultat suivant :
j'aimerais lancer mon userform en plein écran sans masquer la barre des taches.
auriez vous une solution à mon problème?
Grand merci à vous !
Bonjour,
Voici un exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Option Explicit Private Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long Private Sub UserForm_Initialize() Dim ppx As Double With CreateObject("WScript.Shell") ppx = .RegRead("HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI") / 72 End With With Me .Left = 0 .Top = 0 .Width = GetSystemMetrics32(0) / ppx .Height = GetSystemMetrics32(1) / ppx End With End Sub
Un second exemple qui laisse la barre des tâches windows apparente ou qu'elle soit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" _ (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Sub UserForm_Initialize() Dim ppx As Double With CreateObject("WScript.Shell") ppx = .RegRead("HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI") / 72 End With Dim rc As RECT Call SystemParametersInfo(48, 0&, rc, 0&) With Me .StartUpPosition = 0 .Left = rc.Left / ppx .Top = rc.Top / ppx .Width = (rc.Right - rc.Left) / ppx .Height = (rc.Bottom - rc.Top) / ppx End With End Sub
Partager