Gérard Laloux a écrit :
...

Dernière petite question ... mais il n'y a aucune urgence (c'est dimanche et ça va bientôt être l'heure de l'apéro ...).

Macro de l'après apéro :-)



Sub SupprimeAccents
    Dim oDocument As Object, oSheet As Object
     Dim Col As Integer, Lig As Integer
     Dim x As Integer, y As Integer
     Dim LigDeb As Integer, LigFin As Integer
     Dim ColDeb As Integer, ColFin As Integer
     Dim Txt As String
   '
     oDocument=ThisComponent
   Selection = oDocument.CurrentSelection
   SelectRange = Selection.RangeAddress
   '
   'Coordonnées plage sélectionnée
   ColDeb = SelectRange.StartColumn
   LigDeb = SelectRange.StartRow
   ColFin = SelectRange.EndColumn
   LigFin = SelectRange.EndRow
     '
     oSheet=oDocument.currentController.ActiveSheet
   '
     For y = ColDeb To ColFin
         For x = LigDeb to LigFin
            Txt = oSheet.getCellByPosition(y, x).getString
             Nc = Len(Txt)
             For n = 1 to Nc
                 Car = Mid(Txt, n, 1)
                 If Car = "é" Or Car ="è" Or Car = "ê" Or Car = "ë" Then
                     Car = "e"
                     Mid(Txt, n, 1) = Car
                     oSheet.getCellByPosition(y, x).setString(Txt)
                 ElseIf Car = "â" Or Car ="à" Or Car ="ä" Then
                     Car = "a"
                     Mid(Txt, n, 1) = Car
                     oSheet.getCellByPosition(y, x).setString(Txt)
                 ElseIf Car = "_" Or Car ="-" Then
                     Car = ""
                     Mid(Txt, n, 1) = Car
                     oSheet.getCellByPosition(y, x).setString(Txt)
                     Nc = Nc - 1
                 Endif
             Next n
         Next x
     Next y
End Sub



Bon, si tu sélectionnes pas de cellules, dommage  :-P

Bon surf,
Christian

--
Visitez http://christianwtd.free.fr/ pour débuter avec Calc, d'OpenOffice.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à