Bonjour,
J'ai finalisé une application VBA et je me casse la tête sur des problèmes apparaissant quand je change d'ordi (bien sûr qui ont des versions d'excell antérieures ou postérieures). Car je suppose que ceci est lié à ces différences de version.
Parmi eux, il en ai un qui commence à bien m'énerver : afficher en plein écran mes différentes USERFORM.
J'ai donc utilisé les procédures des tutoriels :
Associé au programme inscrit dans un module (pour enlever la barre de menu) :
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 'Dans l'userform Private Sub UserForm_Activate() With Me .StartUpPosition = 3 .Width = Application.Width .Height = Application.Height .Left = 0 .Top = 0 End With End Sub Private Sub UserForm_Initialize() 'On passe en arguments : ' - le titre de la fenêtre ' - False pour masquer la barre de titre AfficheTitleBarre Me.Caption, False End Sub
Mon souci :
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Const GWL_STYLE = (-16) Const WS_CAPTION = &HC00000 Const SWP_FRAMECHANGED = &H20 Public Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long Public Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Public Declare Function SetWindowPos Lib "user32" _ (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _ ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _ ByVal wFlags As Long) As Long Sub AfficheTitleBarre(stCaption As String, pbVisible As Boolean) Dim vrWin As RECT Dim style As Long Dim lHwnd As Long '- Recherche du handle de la fenêtre par son Caption lHwnd = FindWindowA(vbNullString, stCaption) If lHwnd = 0 Then MsgBox "Handle de " & stCaption & " Introuvable", vbCritical Exit Sub End If GetWindowRect lHwnd, vrWin style = GetWindowLong(lHwnd, GWL_STYLE) If pbVisible Then SetWindowLong lHwnd, GWL_STYLE, style Or WS_CAPTION Else SetWindowLong lHwnd, GWL_STYLE, style And Not WS_CAPTION End If SetWindowPos lHwnd, 0, vrWin.Left, vrWin.Top, vrWin.Right - vrWin.Left, _ vrWin.Bottom - vrWin.Top, SWP_FRAMECHANGED End Sub
Ce programme fonctionne très bien sur mon Excel 2007. Quand je l'utilise sur Excell 2010, l'userform est réduite à sa plus petite expression.
Sous excell 2007 , application.width et .height fonctionnent en récupérant la taille de l'écran
Sous excell 2010, ils renvoient que des versions minimales d'une Userform (je ne vois donc qu'un confeti de mon Userform).
Est-ce un problème de version excel comme je le soupçonne ?
Comment modifier mes procédures pour que l'affichage plein écran fonctionne quelle que soit la version Excell utilisée ?
Merci d'avance.
Question subsidiaire : lorsque je passe d'une userform à une autre, on voit mes onglets excel qui apparaissent et ça ne donne pas un super rendu même en essayant d'insérer des application.screenupdating :
Comment ne pas faire "sauter" l'image et faire un liant parfait entre différentes Userform qui "normalement" sont en plein écran.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Private sub_fermeture_fenetre1 application.screenupdating = false Unload USF_Fenetre1 USF fenetre2.show application.screenupdating = true end sub
Merci d'avance
Merci de votre aide.
Partager