13 messages in org.openoffice.fr.progRe: [prog] conversion macro excel ve...
FromSent OnAttachments
jacques23270May 28, 2007 8:28 am 
BobMay 28, 2007 9:44 am 
SEGUIN FrançoisMay 28, 2007 9:48 am 
JacquesMay 28, 2007 10:48 am 
BobMay 28, 2007 1:02 pm 
BobMay 28, 2007 3:29 pm 
SEGUIN FrançoisMay 28, 2007 11:09 pm 
JacquesMay 29, 2007 10:40 am 
BobMay 29, 2007 1:13 pm 
BobMay 29, 2007 1:22 pm 
c.ma...@univitis.frMay 29, 2007 11:14 pm 
steveJun 1, 2007 12:25 am 
Francois GattoJun 1, 2007 4:17 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] conversion macro excel vers OpenActions...
From:SEGUIN François (fseg@wanadoo.fr)
Date:May 28, 2007 9:48:52 am
List:org.openoffice.fr.prog

Bonjour jacques

Voici un bout de code qui permet de colorisé le fond de cellules sous calc. Moi je le fait pour 10 valeurs mais il suffit d'extrapoler. Les couleurs sont direbctement en entier type long mais tu peut le faire avec MaCellule.CellBackColor = RGB(x,x,x) ou x est l'indice de couleur entre 0 et 255.

Voilà Bon courage

François

rem * DECLARATION DES VARIABLES dim i as integer dim MaCellule as object dim ValeurCellule as integer

rem * BOUCLE DE COLORATION For i = 1 to 10

rem * ACCES A L'OBJET CELLULE EN FONCTION DE LA POSITION MaCellule = ThisComponent.Sheets.getByName("Feuille1").getCellByPosition(0,8+i)

rem * RECUPERATION DE LA VALEUR DE LA CELLULE ValeurCellule = MaCellule.Value

' print ValeurCellule

rem * COLORATION EN FONCTION DE LA VALEUR Select Case ValeurCellule Case 0 MaCellule.CellBackColor = 16711680 Case 1 MaCellule.CellBackColor = 16724736 Case 2 MaCellule.CellBackColor = 16737792 Case 3 MaCellule.CellBackColor = 16750848 Case 4 MaCellule.CellBackColor = 16763904 Case 5 MaCellule.CellBackColor = 16776960 Case 6 MaCellule.CellBackColor = 13827846 Case 7 MaCellule.CellBackColor = 10878727 Case 8 MaCellule.CellBackColor = 7929608 Case 9 MaCellule.CellBackColor = 4980489 Case 10 MaCellule.CellBackColor = 2031370 Case Else MaCellule.CellBackColor = -1 End Select Next i

----- Original Message ----- From: "jacques23270" <jacq@laposte.net> To: <pr@fr.openoffice.org> Sent: Monday, May 28, 2007 5:28 PM Subject: [prog] conversion macro excel vers Open

Bonjour, Suite à un transfert de fichiers d’Excel vers Calc, j’ai un problème de conversion de macro. La macro sous Excel permet de mettre en couleur les cellules d’un planning de 969 cases en fonction du contenu de la case et des infos d’une autre feuille contenant les codes couleurs et les différents textes servant à la comparaison (35 infos différentes). Cela donne sous excel, le code suivant :

Option Explicit Sub mise_en_couleur() Dim Compt_colonne, Compt_ligne, Spinner, Strings, i, texte1, li, col, colo, ColorIndex As Integer Dim msg, Style, Title, Réponse, MaChaine msg = "Cette procédure dure de 30 à 60 secondes, Voulez-vous la lancer ?" ' Définit le message. Style = vbYesNo ' Définit les boutons. Title = "Mise en couleur du planning année" ' Définit les titres. ' Affiche le message. Réponse = MsgBox(msg, Style, Title) If Réponse = vbYes Then ' L'utilisateur a choisi le bouton Oui. MaChaine = "Oui" ' Accomplit une action. 'mise en couleur Sheets("4-plan-année").Select ActiveSheet.Unprotect Range("F7").Select li = 6 col = 5 For i = 1 To 35 Sheets("3-Récapitulatif année").Select Cells(li, col).Activate Strings = ActiveCell.Value Sheets("3-Récapitulatif année").Select Cells(li, (col - 4)).Activate texte1 = ActiveCell.Value Sheets("4-plan-année").Select For Compt_colonne = 6 To 25 For Compt_ligne = 7 To 58 If Cells(Compt_ligne, Compt_colonne) = Strings Then Cells(Compt_ligne, Compt_colonne).Interior.ColorIndex = texte1 End If Next Next li = li + 1 Next End If Range("F7").Select End Sub

Mon problème est de passer cette macro sous Calc. Quelqu’un peut-il m’aider ? d’avance merci