Consulting

Results 1 to 7 of 7

Thread: How to delete all lower case words

  1. #1
    VBAX Newbie
    Joined
    Jan 2023
    Posts
    5
    Location

    How to delete all lower case words

    How can I delete all lower case words in an MS Word doc? Meaning all words that begin with a lower case letter.Thank you?

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    Untested here ... change UPPER CASE letters to lower case and apply ...

    https://superuser.com/questions/1576...g-find-replace

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I don;t know the correct VBA for Word terminology, but basically
    For Each Word in AllWords
       If Word = LCase(Word) Then Word.Delete
    End If
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    Use a wildcard search for
    <[a-z]{1,}>
    replace with nothing
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  5. #5
    VBAX Newbie
    Joined
    Jan 2023
    Posts
    5
    Location
    Thank you all! A few comments in case others read this:
    1) I had seen that before but couldn't get it to work. One needs to check the "Use Wildcards" box for this to work
    2) It doesn't work for contractions, words like "isn't" and "weren't" Is there a simple mod to the line above that would also cover words like that or words with special characters?"

  6. #6
    You can add the character you want e.g.

    <[a-z']{1,}>

    See https://www.gmayor.com/replace_using_wildcards.htm
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  7. #7
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,053
    Location
    Sorry to butt in here Graham but, as I understand your suggestion <[a-z'] {1,}>, will find all lower case letters within the range a to z and the apostrophe, and replace them with nothing. Will this not also find the lower case letters of a word starting with an Upper case?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •