AntiGuide: DenumeroterLignesMsWord



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.216.92 :: Signaler un abus :: le: 20250721 10:25:51
à tout de suite

salut,

voici l'outil du matin:
--------------------------------------------------------X%
Sub denum()
'
' denum Macro
' Macro enregistrée le 04/02/2013 par PO
'
  Dim dom As New MSForms.DataObject

While True
    Selection.HomeKey Unit:=wdLine
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = " "
        .Replacement.Text = ""
        .Forward = True
    '    .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
 '   Selection.Find.Execute
 '   Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
 On Error GoTo fini
        Selection.Copy
        On Error GoTo 0
        
    dom.GetFromClipboard
    prem = dom.GetText
 ' vérifier tout chiffre
 toutnu = True
 For i = 1 To Len(prem)
   If InStr("0123456789", Mid(prem, i, 1)) = 0 Then toutnu = False
   Next
   
   If toutnu Then Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.MoveDown Unit:=wdLine, Count:=1
Wend
   
fini:
   
  End Sub
------------------------------------------------------------------X%
GAFFE: nécessite une référence à c:\windows\system32\FM20.dll

évidemment on peut faire plus compliqué, un peu, beaucoup, à  folie.

promis, dans pas longtemps la version OO.

maintenant, je vas le dire à l'antiguide:
http://antiguide.free.fr/wiki/wakka.php?wiki=DenumeroterLignesMsWord

à+
PO.