#1
|
|||
|
|||
Capitalize one to two words if they are the only words on a line
Quick question. My process of reformatting pasted documents from various formats (PDF,Outlook/HTML,etc.) has been quite the headache. My macro is getting to be pretty impressive in its power, however I was wondering if any knowledgeable VB coders could advise on this last headache...
I'm dealing with Resumes, and after stripping the formatting, I like to capitalize headers for each section in plain text. Ie Name Address Phone SUMMARY xxx PROFESSIONAL EXPERIENCE xxx EDUCATION xxx Is there a macro that can be intelligent enough to only capitalize say, Education, in the instance that it is the only word on the line consisting of A-Z characters? I say A-Z because sometimes strange space characters get through from time to time in front of the word... What about a Macro that erases any character that is not A-Z or 0-9 from the start of a line? And finally, is it possible to make the instances of "Professional Experience", "professional experience", "experience" or "work history" into "PROFESSIONAL EXPERIENCE", only if each example is the only word or pair of words on that given line? I.E., not capitalizing the word experience if it appears in the body of a paragraph elsewhere. Thanks for the wisdom. I know I ask a lot, but I have faith someone might already have a few tricks for me! |
#2
|
||||
|
||||
For a macro that handles the reformatting of text sourced from a wide range of material, including PDFs emails & web pages, see: https://www.msofficeforums.com/word/...html#post32907
That may also resolve your issue with 'strange space characters get through from time to time in front of the word'. As for a macro to capitalise words in scenarios like you said, you might try something along the lines of: Code:
Sub Demo() Application.ScreenUpdating = False Dim Para As Paragraph For Each Para In ActiveDocument.Paragraphs With Para.Range .End = .End - 1 If .ComputeStatistics(wdStatisticWords) < 3 Then .Text = Trim(UCase(.Text)) End If End With Next Application.ScreenUpdating = False End Sub Find = ^pprofessional experience^p Replace = ^pPROFESSIONAL EXPERIENCE^p such processing could be incorporated into a macro based on the one in the above link.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to solve duplicate words in one line | Bookmaster | Word VBA | 7 | 02-03-2015 04:30 PM |
How to mark underlined words in a sentence as A, B, C, D (beneath the words) | thudangky | Word | 13 | 12-12-2013 02:22 AM |
Is there a way to capitalize the all the words except the prepositions? | Jamal NUMAN | Word | 2 | 08-06-2011 11:46 PM |
Why Words doesn’t show the style of the selected words automatically???? | Jamal NUMAN | Word | 0 | 04-14-2011 03:20 PM |
Creating different spacing for words on the same line | Jenjen80 | Word | 1 | 08-12-2010 05:52 AM |