For Each MyShape In MyHeader.Shapes
If MyShape.TextFrame.HasText Then _
MyShape.TextFrame.TextRange.Fields.Update
Next MyShape
This code still works perfectly on Word 2003, but on Word 2007 it gives an error when the Shape is a picture, and I suspect it would fail for some other types of shape too.
I looked on MSDN and found a helpful note that says.
I'm happy to add a Select Case MyShape.Type to select only shapes with TextFrames, but I can't find a list of which shape types have TextFrames and which ones don't.MSDN wrote: Some shapes do not support attached text (lines, freeforms, pictures, and OLE objects, for example). If you attempt to return or set properties that control text in a text frame for those objects, an error occurs.
Any suggestions?