Newbie Help: All caps to Title caps  
Author Message
I am Josha





PostPosted: Visual Basic for Applications (VBA), Newbie Help: All caps to Title caps Top

Hi
I need to create a macro that will start at the begining of a Word document and select all sections of text that are in ALLCAPS. It then must change the instances of all caps to title or proper caps. However there are specific two letter codes that must remain as all caps. Is this possible

Basically, a mail merge that uses a database query as the datasource is importing address and name details in allcaps. To maintain professionalism, it is desired that these items are in proper caps. However, the letter contains two letter 'class codes' that must remain in all caps (eg. BI, FH, LF, NM).

I am only just learning VB and can only get the macro the select the whole document and change it to proper caps. Manually selecting the required text is not an option because the merge contains many records. This would take too long.

My other thought was to use a macro to select specific line/column reference to select the required text, then change it to proper caps, then repeat for each page. I dont know how to do this either and it is not ideal as the template letter may change, invalidating the references.

Any help would be much appreciated. I am *very* new to VB, so sample code would be great.
Josha

Microsoft ISV Community Center Forums2  
 
 
Peter Mo.





PostPosted: Visual Basic for Applications (VBA), Newbie Help: All caps to Title caps Top

Hi Joshua

A simpler way may be to produce a name and address file using the database query, then post-process this to produce the correct format. The result could then be used in the mail merge.

Regards

PeterMo.