Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. Sub RemoveAppendices()
  2. Dim i As Integer
  3. Application.ScreenUpdating = False
  4. Selection.HomeKey Unit:=wdStory
  5. 'Cntr = 3
  6. 'For i = 1 To 3
  7. For i=3 to 1 step -1
  8. With Selection.Find
  9. .ClearFormatting
  10. .Text = "APPENDIX" & Cntr
  11. If Selection.Find.Execute Then
  12. Selection.Select
  13. Selection.Delete
  14. With Selection
  15. .EndKey Unit:=wdStory
  16. .TypeBackspace
  17. .Delete
  18. End With
  19. End If
  20. End With
  21. 'Cntr = Cntr - 1
  22.  
  23. Next i
  24. End Sub
  25.  
  26. Sub RemoveAppendices()
  27. Dim i As Integer
  28. For i = 3 To 1 Step -1
  29. 'Selection.HomeKey Unit:=wdStory 'this would also work but I like wrap better
  30. With Selection.Find
  31. .Wrap = wdFindContinue
  32. .Text = "APPENDIX" & i
  33. .MatchWholeWord = True
  34. .MatchCase = True
  35. If Selection.Find.Execute Then
  36. Selection.Select
  37. Selection.Delete
  38. With Selection
  39. .EndKey Unit:=wdStory
  40. .TypeBackspace
  41. .Delete
  42. End With
  43. End If
  44. End With
  45. Next i
  46. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement