Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #19  
Old 02-19-2024, 11:37 PM
Guessed's Avatar
Guessed Guessed is offline Last line of paragraph centered Windows 10 Last line of paragraph centered Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

On my machine I tested it with consistently sized text (first word same as rest of paragraph). Since your document has a differently sized first word you are getting an offset. Therefore the code would need to be adapted to position the frame higher and the size of this offset will vary depending on the relative size difference of first/rest of paragraph.

This is my attempt to show what might work. I've included a line so it is easier to see where the frame is. That line could be disabled/removed once you have it working correctly. You may need to fiddle with parameters to get the offset that works for your specific sizes and typefaces.
Code:
Sub DropCapMeHebrew()
  Dim aFrame As Frame, aPara As Paragraph, aWord As Range, iOffset As Integer
  For Each aPara In Selection.Range.Paragraphs
    If aPara.Range.Frames.Count = 0 Then
      Set aWord = aPara.Range.Words.First
      iOffset = aWord.Font.Size - aPara.Range.Words.Last.Font.Size
      Set aFrame = ActiveDocument.Frames.Add(Range:=aWord)
      With aFrame
        .Borders.OutsideLineStyle = wdLineStyleNone
        .HorizontalDistanceFromText = 2
        .Shading.ForegroundPatternColor = wdColorAqua
        .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
        .VerticalPosition = .VerticalPosition - iOffset
      End With
    End If
  Next aPara
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Centered line before and after a word Miguel Word 6 02-05-2023 09:02 AM
Last line of paragraph centered Hard Paragraph after Every Line jcolleenb Word 2 06-08-2020 03:50 PM
syntax for inserting blank line before inserting table and after a line or paragraph SamDsouza Word VBA 8 08-04-2019 11:10 PM
Last line of paragraph centered line separator for paragraph creieru Word 1 06-07-2012 11:11 AM
Last line of paragraph centered How can I make this line look like a paragraph? steeleye Excel 1 07-15-2009 02:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:00 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