#1
|
|||
|
|||
Automatically update Drop Caps?
I have a 1,500 page story in Word. I am working on formatting and have changed the paragraph spacing. This messes up the sizing of the Drop Caps. I have drop caps sized at 2 and 3 lines.
The way to fix this would be to select each drop cap letter, go to drop cap settings and click "ok" to update this. Is there a way to automatically update all the drop caps? |
#2
|
|||
|
|||
I've tried ChatGPT to get a macro to do this but I always get an error.
This is what ChatGPT came up with, but I receive Compile error: Method or data member not found Sub ApplyDropCapOptions() Dim rng As Range Dim dropCap As DropCap ' Loop through each paragraph in the document For Each rng In ActiveDocument.Paragraphs.Range ' Check if the paragraph has a drop cap If rng.DropCap = True Then ' Select the drop cap rng.Select ' Open the Drop Cap Options dialog box Set dropCap = Selection.ParagraphFormat.DropCap dropCap.Clear ' Click "OK" to apply default settings dropCap.Enable = True dropCap.Position = wdDropNormal dropCap.LinesToDrop = 1 ' Close the Drop Cap Options dialog box dropCap.Clear End If Next rng End Sub |
#3
|
|||
|
|||
Code:
Sub ApplyDropCapOptions() 'To clear all Dim lngPar As Long Dim oPar As Paragraph Dim dropCap As dropCap For lngPar = ActiveDocument.Paragraphs.Count To 1 Step -1 Set oPar = ActiveDocument.Paragraphs(lngPar) If Len(oPar.Range.Text) > 1 Then With oPar.dropCap If .Position <> wdDropNone Then .Clear End If End With End If Next lngPar End Sub Sub ApplyDropCapOptionsII() 'To set all applied drop caps to 2 Dim lngPar As Long Dim oPar As Paragraph Dim dropCap As dropCap For lngPar = ActiveDocument.Paragraphs.Count To 1 Step -1 Set oPar = ActiveDocument.Paragraphs(lngPar) If Len(oPar.Range.Text) > 1 Then With oPar.dropCap If .Position <> wdDropNone Then .LinesToDrop = 2 End If End With End If Next lngPar End Sub |
#4
|
|||
|
|||
Thank you gmaxey, I don't see any change in the drop caps after running this. I also get an error at the end: Run-time error '4605': This method or property is not available because the current paragraph has no text.
Is there a special way I am supposed to run this macro? The first macro is supposed to clear all drop caps and the second macro is supposed to set all drop caps to 2 lines, is that correct? |
#5
|
|||
|
|||
That is strange. Especially the error as there is a conditional if in the code to try processing empty paragraphs. What version of Word are you using. I just tested again with Word 2019 and Word 2010 and both worked fine (albeit the document was a very simple document with a few lines of text).
Yes, you are correct as to how they are intended to work. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to convert first word of each section to Drop Caps | wrdy | Word VBA | 2 | 05-30-2023 01:20 PM |
Powerpoint-2019 Text in selected theme remains in All Caps even when small caps option is selected | Tanasha4 | PowerPoint | 2 | 04-06-2019 07:53 PM |
Need a Macro to Change Every Instance of Small Caps to All Caps and Reduce the Font by 2 Points | CrossReach | Word VBA | 2 | 11-13-2017 09:21 AM |
Drop Caps Problem | dustnik | Word | 5 | 12-12-2016 01:14 PM |
Multiple drop caps | Ziggy-R | Publisher | 0 | 10-26-2010 06:23 PM |