D
Dylan
I am able to use the for each - next method to run through textframes, and
if a frame with a width greater than 200 is encountered I am able to set the
left and right indentations.
However, I can seem to be able to change the alignment of the text where the
string "N/A" is found inside the frame. Am I going about this the correct
way?
This will let me set the indentation, and following it is the code I have
written to try to select textframes with the string "N/A"
Sub FormatTextbox()
Dim shp As Shape
Dim Sel As Selection
' Switch Screen Updating off
Word.Application.ScreenUpdating = False
For Each shp In ActiveDocument.Shapes
' Format Plain Textboxes
If shp.Width > 240 Then
shp.Select
With Selection
.ParagraphFormat.LeftIndent = CentimetersToPoints(0.25)
.ParagraphFormat.RightIndent = CentimetersToPoints(0.14)
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Range.Font.Name = "Times New Roman"
.Range.Font.Size = 10
End With
' [Following Code goes here]
End If
'[Following Code]
Next shp
End Sub
ElseIf shp.TextFrame.TextRange.Text = "*[N/A]*" Then
shp.Select
With Selection
' Set text to centred alignment
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.MoveLeft Unit:=wdCharacter, Count:=3
.TypeParagraph
' Set the font size to 10
.Font.Size = 10
.ShapeRange.Select
.Font.Size = 10
End With
Any help would be appreciated.
Dylan
if a frame with a width greater than 200 is encountered I am able to set the
left and right indentations.
However, I can seem to be able to change the alignment of the text where the
string "N/A" is found inside the frame. Am I going about this the correct
way?
This will let me set the indentation, and following it is the code I have
written to try to select textframes with the string "N/A"
Sub FormatTextbox()
Dim shp As Shape
Dim Sel As Selection
' Switch Screen Updating off
Word.Application.ScreenUpdating = False
For Each shp In ActiveDocument.Shapes
' Format Plain Textboxes
If shp.Width > 240 Then
shp.Select
With Selection
.ParagraphFormat.LeftIndent = CentimetersToPoints(0.25)
.ParagraphFormat.RightIndent = CentimetersToPoints(0.14)
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Range.Font.Name = "Times New Roman"
.Range.Font.Size = 10
End With
' [Following Code goes here]
End If
'[Following Code]
Next shp
End Sub
ElseIf shp.TextFrame.TextRange.Text = "*[N/A]*" Then
shp.Select
With Selection
' Set text to centred alignment
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.MoveLeft Unit:=wdCharacter, Count:=3
.TypeParagraph
' Set the font size to 10
.Font.Size = 10
.ShapeRange.Select
.Font.Size = 10
End With
Any help would be appreciated.
Dylan