Par contre le plus gros problème est que ça freeze le classeur et que rien n'est accessible sur le classeur à part l'UserForm.
Il me dit que F n'est pas une variable déclarée, donc je lui met P4_Menu (le nom de mon UserForm, pour qu'il ne m'embête plus!
Set F UserForm1 '>> mets ici le nom de TON userform (celui à afficher sur la feuille Excel)
mais l'UserForm se met en plein milieu
.Top = Application.Top + Application.Height - Application.UsableHeight - Rows(ActiveWindow.ScrollRow).Top + Range("A1").Top - bordh .Left = Application.Left + Application.Width - Application.UsableWidth - Columns(ActiveWindow.ScrollColumn).Left + Range("A1").Left + bordv
.Top = Application.Top + Application.Height - Application.UsableHeight - Rows(ActiveWindow.ScrollRow).Top + 80 - bordh .Left = Application.Left + Application.Width - Application.UsableWidth - Columns("A:A").Left + Range("A1").Left + bordv
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long 'les fonctions sui suivent ne sont là que si l'on veut supprimer la barre de titre Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long Private F As Object Private Sub Worksheet_Activate() Set F P4Menu '>> mets ici le nom de TON userform (celui à afficher sur la feuille Excel) coucou End Sub Private Sub Worksheet_Deactivate() P4Menu.Hide End Sub Private Sub coucou() Dim bordv As Integer, bordh As Integer Range("A1").Activate cacher_barre_titre '=====>>>> uniquement si l'on veut cacher la barre de titre bordv = GetSystemMetrics(15) - (GetSystemMetrics(5) * 5) bordh = GetSystemMetrics(5) * 3 If ActiveWindow.DisplayHeadings = False Then bordv = GetSystemMetrics(5) * -4 bordh = GetSystemMetrics(15) End If With F .Show .StartUpPosition = 0 .Top = Application.Top + Application.Height - Application.UsableHeight - Rows(ActiveWindow.ScrollRow).Top + Range("A1").Top - bordh .Left = Application.Left + Application.Width - Application.UsableWidth - Columns(ActiveWindow.ScrollColumn).Left + Range("A1").Left + bordv End With End Sub Private Sub cacher_barre_titre() Dim hWnd As Long, Style As Long hWnd = FindWindow(vbNullString, F.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd DoEvents End Sub
Private Sub Worksheet_Activate() With ActiveWindow .SplitColumn = 2 .SplitRow = 2 End With End Sub
Private Sub Worksheet_Activate() With ActiveWindow .SplitColumn = 2 .SplitRow = 2 ActiveWindow.FreezePanes = True End With End Sub
si oui : tu as 4 volets. Dans lequel souhaites-tu l'userform ?
.Panes(1).ScrollRow = 1 .Panes(1).ScrollColumn = 1
Tu pourras m'expliquer un tout ptit peu après? que je puisse savoir à quoi les éléments de cette macro correspondent, mais aussi pouvoir la refaire un jour ou l'autre!
Je sais que user32 c'est un "élément" de windows qui permet d’interagir avec plein de chose( J'ai commencé rapidement le C++ et ils en parlaient) , mais après je ne comprend pas grand chose.