Augmenter la hauteur de la liste des zones nommées
1 réponse
ejmj.bleuez
Bonjour,
Je suis sur excel 97
Est-il possible d'augmenter la hauteur de la liste de zones nommées
de façon à éviter l'usage des curseurs de défilement quand la liste des
zones nommées est importante ?
Merci d'avance
ebleuez
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Private Type COMBOBOXINFO cbSize As Long rcItem As RECT rcButton As RECT stateButton As Long hwndCombo As Long hwndItem As Long hwndList As Long End Type
Sub Ajust() Dim NbLg$ NbLg = InputBox("Nombre de lignes", "Fixer le nombre de lignes", 15&) If IsNumeric(NbLg) Then MsgBox ("Nouveau nombre de lignes = " & _ AjustComboNoms(CLng(NbLg))) End Sub
Function AjustComboNoms&(NbLigne&) Const CB_GETITEMHEIGHT& = &H154, CB_GETCOUNT& = &H146 Dim CBHwnd&, CBItNb&, CBItHeight&, CBItem&, _ CBInfo As COMBOBOXINFO, CBLRect As RECT CBHwnd = FindWindowEx(FindWindowEx(FindWindowEx(0&, 0&, _ "XLMAIN", Application.Caption), 0&, "EXCEL;", _ vbNullString), 0&, "ComboBox", vbNullString) CBInfo.cbSize = Len(CBInfo) GetComboBoxInfo CBHwnd, CBInfo SetFocus SetFocus(CBInfo.hwndItem) CBItHeight = SendMessage(CBHwnd, CB_GETITEMHEIGHT, 0&, 0&) CBItNb = SendMessage(CBHwnd, CB_GETCOUNT, 0&, 0&) If CBItNb = 0& Then Exit Function GetClientRect CBInfo.hwndList, CBLRect CBItem = CBLRect.Bottom / CBItHeight GetWindowRect CBInfo.hwndList, CBLRect If NbLigne < 7& Then NbLigne = 7& If NbLigne > CBItNb Then NbLigne = CBItNb With CBLRect MoveWindow CBInfo.hwndList, .Left, .Top, .Right - .Left, _ .Bottom - .Top + ((NbLigne - CBItem) * CBItHeight), 1& End With AjustComboNoms = NbLigne End Function 'AC
Alain CROS
"ejmj.bleuez" a écrit dans le message de news: c8lfv6$rk0$
Bonjour, Je suis sur excel 97 Est-il possible d'augmenter la hauteur de la liste de zones nommées de façon à éviter l'usage des curseurs de défilement quand la liste des zones nommées est importante ? Merci d'avance ebleuez
Bonjour.
Pour la zone Nom au dessus de la colonne A :
Private Declare Function SetFocus& Lib "user32" _
(ByVal hwnd&)
Private Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" _
(ByVal hwnd&, ByVal wMsg&, ByVal wParam&, lParam As Any)
Private Declare Function GetComboBoxInfo& Lib "user32" _
(ByVal hwndCombo&, pcbi As COMBOBOXINFO)
Private Declare Function GetClientRect& Lib "user32" _
(ByVal hwnd&, lpRect As RECT)
Private Declare Function GetWindowRect& Lib "user32" _
(ByVal hwnd&, lpRect As RECT)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type COMBOBOXINFO
cbSize As Long
rcItem As RECT
rcButton As RECT
stateButton As Long
hwndCombo As Long
hwndItem As Long
hwndList As Long
End Type
Sub Ajust()
Dim NbLg$
NbLg = InputBox("Nombre de lignes", "Fixer le nombre de lignes", 15&)
If IsNumeric(NbLg) Then MsgBox ("Nouveau nombre de lignes = " & _
AjustComboNoms(CLng(NbLg)))
End Sub
Function AjustComboNoms&(NbLigne&)
Const CB_GETITEMHEIGHT& = &H154, CB_GETCOUNT& = &H146
Dim CBHwnd&, CBItNb&, CBItHeight&, CBItem&, _
CBInfo As COMBOBOXINFO, CBLRect As RECT
CBHwnd = FindWindowEx(FindWindowEx(FindWindowEx(0&, 0&, _
"XLMAIN", Application.Caption), 0&, "EXCEL;", _
vbNullString), 0&, "ComboBox", vbNullString)
CBInfo.cbSize = Len(CBInfo)
GetComboBoxInfo CBHwnd, CBInfo
SetFocus SetFocus(CBInfo.hwndItem)
CBItHeight = SendMessage(CBHwnd, CB_GETITEMHEIGHT, 0&, 0&)
CBItNb = SendMessage(CBHwnd, CB_GETCOUNT, 0&, 0&)
If CBItNb = 0& Then Exit Function
GetClientRect CBInfo.hwndList, CBLRect
CBItem = CBLRect.Bottom / CBItHeight
GetWindowRect CBInfo.hwndList, CBLRect
If NbLigne < 7& Then NbLigne = 7&
If NbLigne > CBItNb Then NbLigne = CBItNb
With CBLRect
MoveWindow CBInfo.hwndList, .Left, .Top, .Right - .Left, _
.Bottom - .Top + ((NbLigne - CBItem) * CBItHeight), 1&
End With
AjustComboNoms = NbLigne
End Function 'AC
Alain CROS
"ejmj.bleuez" <ejmj.bleuez@wanadoo.fr> a écrit dans le message de news: c8lfv6$rk0$1@news-reader4.wanadoo.fr...
Bonjour,
Je suis sur excel 97
Est-il possible d'augmenter la hauteur de la liste de zones nommées
de façon à éviter l'usage des curseurs de défilement quand la liste des
zones nommées est importante ?
Merci d'avance
ebleuez
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Private Type COMBOBOXINFO cbSize As Long rcItem As RECT rcButton As RECT stateButton As Long hwndCombo As Long hwndItem As Long hwndList As Long End Type
Sub Ajust() Dim NbLg$ NbLg = InputBox("Nombre de lignes", "Fixer le nombre de lignes", 15&) If IsNumeric(NbLg) Then MsgBox ("Nouveau nombre de lignes = " & _ AjustComboNoms(CLng(NbLg))) End Sub
Function AjustComboNoms&(NbLigne&) Const CB_GETITEMHEIGHT& = &H154, CB_GETCOUNT& = &H146 Dim CBHwnd&, CBItNb&, CBItHeight&, CBItem&, _ CBInfo As COMBOBOXINFO, CBLRect As RECT CBHwnd = FindWindowEx(FindWindowEx(FindWindowEx(0&, 0&, _ "XLMAIN", Application.Caption), 0&, "EXCEL;", _ vbNullString), 0&, "ComboBox", vbNullString) CBInfo.cbSize = Len(CBInfo) GetComboBoxInfo CBHwnd, CBInfo SetFocus SetFocus(CBInfo.hwndItem) CBItHeight = SendMessage(CBHwnd, CB_GETITEMHEIGHT, 0&, 0&) CBItNb = SendMessage(CBHwnd, CB_GETCOUNT, 0&, 0&) If CBItNb = 0& Then Exit Function GetClientRect CBInfo.hwndList, CBLRect CBItem = CBLRect.Bottom / CBItHeight GetWindowRect CBInfo.hwndList, CBLRect If NbLigne < 7& Then NbLigne = 7& If NbLigne > CBItNb Then NbLigne = CBItNb With CBLRect MoveWindow CBInfo.hwndList, .Left, .Top, .Right - .Left, _ .Bottom - .Top + ((NbLigne - CBItem) * CBItHeight), 1& End With AjustComboNoms = NbLigne End Function 'AC
Alain CROS
"ejmj.bleuez" a écrit dans le message de news: c8lfv6$rk0$
Bonjour, Je suis sur excel 97 Est-il possible d'augmenter la hauteur de la liste de zones nommées de façon à éviter l'usage des curseurs de défilement quand la liste des zones nommées est importante ? Merci d'avance ebleuez