Mélanger les lettres des mots Word

pangolino Posted messages 20 Status Membre -  
 ??? ou les nombres -
Hello,

I would like to know if there is a way to shuffle the letters of each word in Word, like

"Bonjour tout le monde" would become "rboounj utot el edonm"

Thank you for your help
Configuration: Windows XP Firefox 3.5.2

1 réponse

JvDo Posted messages 1924 Registration date   Status Membre Last intervention   859
 
Hello,
with a bit of code indeed.
1) Set a bookmark "dest" at the place where you want the result.
2) Put this code in a module :
Sub mélange() Randomize Set masel = Selection.Range For Each vword In masel.Words vword = Trim(vword) vwordlen = Len(vword) For vlen = 1 To vwordlen vpos = Int((vwordlen * Rnd) + 1) vwordnew = vwordnew & Mid$(vword, vpos, 1) vword = Left(vword, vpos - 1) & Right(vword, vwordlen - vpos) vwordlen = Len(vword) Next vwordnew = vwordnew & " " Next Set BMRange = ActiveDocument.Bookmarks("dest").Range BMRange.Text = vwordnew ActiveDocument.Bookmarks.Add "dest", BMRange End Sub

3) Select the text you want to shuffle
4) Run the macro.

Best regards.
3
??? ou les nombres
 
Is it possible with numbers on Microsoft Word 2003? If so, could you explain it to me (in enough detail)?

Thank you in advance,

<underline>REGARDLESS.</underline>
0