Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-30-2023, 01:20 PM
gmaxey gmaxey is offline Macro to convert first word of each section to Drop Caps Windows 10 Macro to convert first word of each section to Drop Caps Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub DropCaps()
Dim oSection As Section
Dim lngIndex As Integer
Dim oRng As Range
Dim strText As String
  For Each oSection In ActiveDocument.Sections
    For lngIndex = 1 To oSection.Range.Paragraphs.Count
      If Len(oSection.Range.Paragraphs(lngIndex).Range) > 1 Then
        Exit For
      End If
    Next lngIndex
    Set oRng = oSection.Range.Paragraphs(lngIndex).Range
    strText = oRng.Words(1).Text
    oRng.Collapse wdCollapseStart
    oRng.Select
    With oSection.Range.Paragraphs(lngIndex).DropCap
      .Position = wdDropNormal
      .LinesToDrop = 2
      .DistanceFromText = CentimetersToPoints(0.1)
    End With
    Selection.Paragraphs(1).Next.Range.Words(1).Delete
    Selection.Text = strText
    Selection.Characters.Last.Next.Delete
   Next oSection
    Set oSection = Nothing
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Macro to convert first word of each section to Drop Caps Word macro to change ALL CAPS to UPPERCASE dita Word VBA 14 05-20-2018 10:56 PM
Macro to convert first word of each section to Drop Caps 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
Macro to convert first word of each section to Drop Caps 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft