Question: I'd like to add some exception to the Proper Code such as CEO, UNICEF, NBA, ESPN, BMW, IBM as many other acronyms. Thanks!
Question: I'd like to add some exception to the Proper Code such as CEO, UNICEF, NBA, ESPN, BMW, IBM as many other acronyms. Thanks!
Paul's macro indicates that it is capable of preserving capitalisation of acronyms
If Caps = 0, then upper-case strings like ABC are preserved; otherwise they're converted.
See also the True title case macro on my web site at http://www.gmayor.com/word_vba_examples_2.htm This too will not affect acronyms already capitalised.
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
Thanks for the Reply. let say
i.e:
1) LCell.Formula = ProperCase(LCell.Formula, 0, 0) input IBM DB2 Version For Linux, UNIX, ANd WinDOWs Will be converted to IBM DB2 Version For Linux, UNIX, ANd WinDOWs
2) LCell.Formula = ProperCase(LCell.Formula, 1, 0) input IBM DB2 Version For Linux, UNIX, ANd WinDOWs Will be converted to Ibm Db2 Version for Linux, Unix, and Windows
3) LCell.Formula = ProperCase(LCell.Formula, 0, 1) input IBM DB2 Version For Linux, UNIX, ANd WinDOWs Will be converted to IBM DB2 Version For Linux, UNIX, ANd WinDOWs
4) LCell.Formula = ProperCase(LCell.Formula, 1, 1) input IBM DB2 Version For Linux, UNIX, ANd WinDOWs Will be converted to Ibm Db2 Version For Linux, Unix, And Windows
As you can see 2 and 4 are the best options but they can not preserved acronyms on upper case. number 1 and 3 preserved all upper cases.
I will look into the the link that you sent. once again thanks. If I find a solution I'll share it.
At the beginning of the function I added
Dim StrAllCaps As String
AcronymsCaps = 1 ' This control is not implemented yet. The idea is 0= follows the function rules 1= Acronyms on Upper-Cases as shown on StrExclCaps.
StrExclCaps = " IBM , CEO , UNICEF , C&C , UNIX , DB2 " ' keep adding as many acronyms as many you need to check.
At the very end of the function I added
For i = 0 To UBound(Split(StrExclCaps, ","))StrTmpA = Split(StrExclCaps, ",")(i)Next
StrTmpB = UCase(Left(StrTmpA, 2)) & Right(LCase(StrTmpA), Len(StrTmpA) - 2)
StrTxt = Replace(StrTxt, Trim(StrTmpB), Trim(StrTmpA))
ProperCase = Trim(StrTxt) ' This one is the very last sentence of the function
Following above sample the result is what I expected, it is correct.
LCell.Formula = ProperCase(LCell.Formula, 1, 1) input IBM DB2 Version For Linux, UNIX, ANd WinDOWs Will be converted to IBM DB2 Version For Linux, UNIX, And Windows
Feedback is always welcome.
If the input string is all in UPPERCASE then this function doesnt convert it to proper case.
How to convert a all upper case string to proper case?
Last edited by macropod; 05-11-2017 at 09:29 PM.
Perhaps you should read what I posted in post #19, especially the comments in the first few lines of the code.
Cheers
Paul Edstein
[Fmr MS MVP - Word]
If you are referring to Paul's function, then as I commented earlier, the function has a switch that will optionally preserve upper case to accommodate acronyms.
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
Got it. Thanks.