Consulting

Results 1 to 3 of 3

Thread: VBA to remove random capitalizations

  1. #1

    VBA to remove random capitalizations

    Hello,

    I'm working on editing a high number of PPT presentations submitted by multiple people from different places around the world. Just correcting the grammar and spelling would be a pain, but most submitters also seem to have one infuriating thing in common: adding unnecessary capitalization to random words in the middle of a sentence (a little Bit like This, which is Really irritating to Correct, because I then Need to Manually Select that one initial Letter and retype it).

    Could a kind soul please make a VBA which would convert all words in a slide starting with an uppercase letter to lowercase, except for words at the beginning of a sentence (and the word "I")? If there could additionally be a list of exceptions (i.e. words where the initial letter needs to remain capitalised) which I could complete manually in the VBA, that would be great, but just converting everything except the first word in a sentence to lowercase would be a time- and sanity-saver.

    Thank you in advance for any help you can offer me.

    -Isa

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,259
    Location
    Welcome to VBAX isabelle r. Perhaps this will get you started
    Public Function PropCaps(varLastName) As Variant
        'Purpose  : Proper capitalization of names with more than one Cap such as D'Angelo, O'Brein, McDonald.
        'Note: does not attempt names like MacDoogal. Too many exceptions with names starting with Mac.
        'DateTime : 5/05/2000
        'Author   : Bill Mosca
        Dim varOut As Variant
        Dim intPos As Integer
        If IsNull(varLastName) Then Exit Function
        'Irish
        intPos = InStr(1, varLastName, "MC", vbTextCompare)
        If intPos > 0 Then
            varOut = StrConv(Left(varLastName, 2), vbProperCase) _
                & StrConv(Mid(varLastName, 3), vbProperCase)
        End If
        'Various ancestry.
        intPos = InStr(varLastName, "'")
        If intPos > 0 Then
            varOut = StrConv(Left(varLastName, intPos), vbProperCase) _
                & StrConv(Mid(varLastName, intPos + 1), vbProperCase)
        End If
        PropCaps = varOut
    End Function
    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

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,095
    Location
    You could probably save a lot of time by selecting the Text and changing to 'Sentence Case' from the Font Section. You could do this with vba but even manually should save time.

    sentence.jpg
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

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
  •