Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-29-2022, 11:55 PM
wrdy wrdy is offline Macro to convert first word of each section to Drop Caps Windows XP Macro to convert first word of each section to Drop Caps Office 2007
Advanced Beginner
Macro to convert first word of each section to Drop Caps
 
Join Date: Jan 2014
Posts: 31
wrdy is on a distinguished road
Default Macro to convert first word of each section to Drop Caps

I have a macro that converts the first letter of the first word of each section to Drop Caps. However I would like some help editing the macro so that it will convert the whole first word to Drop Caps, rather than just the first letter. The space after the first word also needs to be deleted in order to keep the left alignment.


I have attached images showing a document before running the macro, after running the macro, and what I want the new macro to do.



Code:
Sub DropCaps()
Dim oSection As Section
Dim i As Integer
    For Each oSection In ActiveDocument.Sections
        For i = 1 To oSection.Range.Paragraphs.Count
            If Len(oSection.Range.Paragraphs(i).Range) > 1 Then
                Exit For
            End If
        Next i
        With oSection.Range.Paragraphs(i).DropCap
            .Position = wdDropNormal
            .LinesToDrop = 2
            .DistanceFromText = CentimetersToPoints(0.1)
        End With
    Next oSection
    Set oSection = Nothing
End Sub

Attached Images
File Type: png before.png (52.4 KB, 31 views)
File Type: png after.png (53.6 KB, 29 views)
File Type: png target.png (270.6 KB, 30 views)
Attached Files
File Type: docx sample text.docx (14.3 KB, 12 views)
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 03:59 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