View Single Post
 
Old 06-21-2021, 10:24 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
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

How about you don't ungroup the shapes and switch to using a paragraph style in your shapes.
Code:
Sub SetTextBoxStyle()
  Dim oShape As Shape, objDoc As Document, oInnerShape As Shape
  Application.ScreenUpdating = False
  Set objDoc = ActiveDocument
  For Each oShape In objDoc.Shapes
    If oShape.Type = msoGroup Then
      For Each oInnerShape In oShape.GroupItems
        FormatAShape oInnerShape
      Next oInnerShape
    Else
      FormatAShape oShape
    End If
  Next oShape
  Application.ScreenUpdating = True
End Sub

Function FormatAShape(oShape As Shape)
  With oShape
    .Line.Visible = msoTrue
    .Line.ForeColor.RGB = RGB(255, 255, 255) ' Set line style.
    .Fill.ForeColor.RGB = RGB(255, 255, 255)  ' Set fill color.
    If .TextFrame.HasText Then
      .TextFrame.TextRange.Font.Reset
      .TextFrame.TextRange.Style = "Normal"   'assumes style exists and has below attributes
'      .TextFrame.TextRange.Font.TextColor.RGB = RGB(8, 8, 8)  ' Set text color.
'      .TextFrame.TextRange.Font.Size = 10  ' Set text size.
'      .TextFrame.TextRange.Font.Name = "Arial Narrow"  ' Set font face.
'      .TextFrame.TextRange.Font.Spacing = 0  ' Set character spacing.
'      .TextFrame.TextRange.Font.Scaling = 100 ' Set character spacing.
'      .TextFrame.TextRange.Font.Position = 0  ' Set character spacing.
    End If
  End With
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote