Guest User

Untitled

a guest
Jun 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Sub TwardaSpacja()
  2.  
  3.  
  4. Dim i As Long
  5.  
  6. Dim licznik_zmian As Long
  7.  
  8.  
  9. licznik_zmian = 0
  10.  
  11.  
  12. maxlines = ActiveDocument.BuiltInDocumentProperties(wdPropertyLines)
  13.  
  14. For i = 1 To maxlines
  15.  
  16.  
  17. DoEvents
  18.  
  19. Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=i, Name:=""
  20.  
  21. Selection.EndKey Unit:=wdLine, Extend:=wdExtend
  22.  
  23. With Selection.Characters
  24.  
  25. If .Count > 4 Then
  26.  
  27. If (.Item(.Count - 2) == Chr(32)) _
  28.  
  29. And (.Item(.Count - 1) >= Chr(65) And .Item(.Count - 1) <= Chr(90) Or .Item(.Count - 1) >= Chr(97) And .Item(.Count - 1) <= Chr(122)) _
  30.  
  31. And (.Item(.Count) = Chr(32)) Then
  32.  
  33. .Item(.Count) = Chr(160)
  34.  
  35. licznik_zmian = licznik_zmian + 1
  36.  
  37. End If
  38.  
  39. End If
  40.  
  41. End With
  42.  
  43.  
  44. Next
  45.  
  46.  
  47. Selection.HomeKey Unit:=wdStory
  48.  
  49.  
  50. MsgBox "Zrobione" & Chr(13) & _
  51.  
  52. "Dokonano " & licznik_zmian & " zmian/y", vbInformation
  53.  
  54.  
  55. End Sub
Advertisement
Add Comment
Please, Sign In to add comment