I need to modify text and change font programmatically.
In the following code, I know ActiveShape doesn't work, but what will?
Sub TR1()Dim sh As Shape Dim sr As ShapeRange Dim i As Integer Dim p As Page For Each p In ActiveDocument.Pages p.Activate Set sr = p.Shapes.FindShapes(Type:=cdrTextShape) For Each sh In sr ActiveShape.Text.Story.Text = Chr(CDec(&H5F)) + ActiveShape.Text.Story.Text + Chr(CDec(&H5F)) ActiveShape.Text.Story.Font = "Charlotte font" Next sh Next pEnd Sub
In your code, as you walk through your "for each shape in a shaperange" loop, sh is the shape with which you are working during any given iteration of that loop.
Unless I'm missing something here, I think you should be able to just work directly with sh, e.g.,
sh.Text.Story.Text = ...
Thanks Eskimo; that got it.