[EMAIL PROTECTED] a écrit :

Bonjour tous,
Je cherche à compter l'absence du caractère " "
Voici la macro qui me convient.

Sub CompteCaract
Dim oTrouve_space As Object
 Dim oTrouve_non_space As Object
oTrouve_space = ThisComponent.createSearchDescriptor
With  oTrouve_space
  .SearchString = " " ' ou un autre caractère de ton choix
  .SearchWords = false
End With

oTrouve_non_space = ThisComponent.createSearchDescriptor
With oTrouve_non_space
  .SearchString = "[^ ]" ' ou un autre caractère de ton choix
  .SearchWords = false
  .SearchRegularExpression=True
End With

MsgBox "Nombre de caractères, sans compter les espaces : " & ThisComponent.findAll(oTrouve_non_space).count & " il y a en plus " & ThisComponent.findAll(oTrouve_space).count & " espaces"
End Sub

Cordialement
--
Pascal

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

Répondre à