![]() |
#12
|
|||
|
|||
![]()
Hey, thanks!
But I think I expressed myself in a misleading way. I was referring to a different code. It should search for all names in a list in the corresponding Word document and then set them in small caps. I hope that's clearer now ... I would have tried the following, but it doesn't work. THX!!! Sub FormatAuthorNamesInSmallCaps() Dim authorNames As Variant Dim rng As Range Dim name As Variant ' Liste der Autorennamen authorNames = Array("Ackermann", "Angermann", "Andersen", "Atzeni", "Baecker", "Ortmann", "Zamoyski", "Ziegler", "Wurzbach", "Zittel", "Zürcher", "Zytphen-Adeler") Application.ScreenUpdating = False Set rng = ActiveDocument.Range For Each name In authorNames With rng.Find .ClearFormatting .Replacement.ClearFormatting .Text = name .Replacement.Text = name .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll If .Found Then rng.Font.SmallCaps = True End If End With rng.SetRange Start:=ActiveDocument.Range.Start, _ End:=ActiveDocument.Range.End Next name Application.ScreenUpdating = True End Sub |
Tags |
chatgpt, names, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Marcia | Word | 2 | 09-27-2018 01:28 AM |
How to find CAPITALIZED names and change them into small caps | dylan.ve | Word VBA | 5 | 02-25-2016 03:15 PM |
Find and replace inside strings containing various names | audioman | Word VBA | 4 | 03-25-2014 11:19 AM |
![]() |
elmousa68 | Word VBA | 5 | 10-15-2013 05:10 PM |
find author names in text | anil3b2 | Word | 0 | 08-02-2010 04:12 AM |