Méthode permettant d'afficher une boite de dialogue avec des couleurs différentes
1 réponse
imej-clavier
Bonjour,
Quelqu'un peut-il me dire le nom de la méthode permettant d'afficher une
boite de dialogue avec un ensemble de couleus (à choisir).
J'ai cherché en vain.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
michdenis
Bonjour imej-clavier,
Il y a ceci qui est déjà paru ici sous la plume ....je ne me souviens plus ..! Probablement de Frédéric Sigonneau ! que tu peux adapter à tes besoins.
'=================================== Sub CouleurFonds() Cells.Interior.Color = Get_Color End Sub '=================================== Function Get_Color() As Long 'DWilliams, mpep 'use Excel's built in Pattern 'dialog control to choose a color
'Pattern dialog control only sets the 'chosen color to the active cell, so we 'activate an 'off screen' cell to set 'and retrieve the color.
Dim currCell As String Dim selectColor As Long
'get the current active cell address currCell = ActiveCell.Address
'screen updates off Application.ScreenUpdating = False
'select a temp cell to receive the color Range("$AZ$1").Activate
'show color pick dialog Application.Dialogs(xlDialogPatterns).Show
'get the selected color from temp cell selectColor = ActiveCell.Interior.Color
'set temp cell back to no color ActiveCell.Interior.ColorIndex = xlNone
'reactivate the initial cell Range(currCell).Activate
'screen updates on Application.ScreenUpdating = True
'return the color selection Get_Color = selectColor
End Function '===================================
Salutations!
"imej-clavier" a écrit dans le message de news:cddnqa$l0k$ Bonjour, Quelqu'un peut-il me dire le nom de la méthode permettant d'afficher une boite de dialogue avec un ensemble de couleus (à choisir). J'ai cherché en vain.
D'avance merci,
Jean-michel
Bonjour imej-clavier,
Il y a ceci qui est déjà paru ici sous la plume ....je ne me souviens plus ..! Probablement de Frédéric Sigonneau ! que
tu peux adapter à tes besoins.
'=================================== Sub CouleurFonds()
Cells.Interior.Color = Get_Color
End Sub
'=================================== Function Get_Color() As Long
'DWilliams, mpep
'use Excel's built in Pattern
'dialog control to choose a color
'Pattern dialog control only sets the
'chosen color to the active cell, so we
'activate an 'off screen' cell to set
'and retrieve the color.
Dim currCell As String
Dim selectColor As Long
'get the current active cell address
currCell = ActiveCell.Address
'screen updates off
Application.ScreenUpdating = False
'select a temp cell to receive the color
Range("$AZ$1").Activate
'show color pick dialog
Application.Dialogs(xlDialogPatterns).Show
'get the selected color from temp cell
selectColor = ActiveCell.Interior.Color
'set temp cell back to no color
ActiveCell.Interior.ColorIndex = xlNone
'reactivate the initial cell
Range(currCell).Activate
'screen updates on
Application.ScreenUpdating = True
'return the color selection
Get_Color = selectColor
End Function
'===================================
Salutations!
"imej-clavier" <imej-clavier@wanadoo.fr> a écrit dans le message de news:cddnqa$l0k$1@news-reader4.wanadoo.fr...
Bonjour,
Quelqu'un peut-il me dire le nom de la méthode permettant d'afficher une
boite de dialogue avec un ensemble de couleus (à choisir).
J'ai cherché en vain.
Il y a ceci qui est déjà paru ici sous la plume ....je ne me souviens plus ..! Probablement de Frédéric Sigonneau ! que tu peux adapter à tes besoins.
'=================================== Sub CouleurFonds() Cells.Interior.Color = Get_Color End Sub '=================================== Function Get_Color() As Long 'DWilliams, mpep 'use Excel's built in Pattern 'dialog control to choose a color
'Pattern dialog control only sets the 'chosen color to the active cell, so we 'activate an 'off screen' cell to set 'and retrieve the color.
Dim currCell As String Dim selectColor As Long
'get the current active cell address currCell = ActiveCell.Address
'screen updates off Application.ScreenUpdating = False
'select a temp cell to receive the color Range("$AZ$1").Activate
'show color pick dialog Application.Dialogs(xlDialogPatterns).Show
'get the selected color from temp cell selectColor = ActiveCell.Interior.Color
'set temp cell back to no color ActiveCell.Interior.ColorIndex = xlNone
'reactivate the initial cell Range(currCell).Activate
'screen updates on Application.ScreenUpdating = True
'return the color selection Get_Color = selectColor
End Function '===================================
Salutations!
"imej-clavier" a écrit dans le message de news:cddnqa$l0k$ Bonjour, Quelqu'un peut-il me dire le nom de la méthode permettant d'afficher une boite de dialogue avec un ensemble de couleus (à choisir). J'ai cherché en vain.