Getting Caption Text from an InlineShape

N

Nick Transier

I have many inline shapes in my word document and I am trying to cut them
and paste them into a new document and name the new document with the
caption text. Please help!

Thanks-Nick
 
R

Ravi \(Newgen\)

Hi Nick,

Try with this code.

''''''''''''''
Dim iShape As Shape
Dim Capt As String
Dim actName As String
Dim newDocName As String

actName = ActiveDocument.Name
For Each iShape In ActiveDocument.Shapes
iShape.Select
If iShape.Type <> msoTextBox Then 'Except Text boxes
Selection.ShapeRange.TextFrame.TextRange.Select
Capt = Trim(Selection.Text)
Capt = Replace(Capt, "" & Chr(13), "")
iShape.Select
Selection.Copy
Documents.Add
Selection.Paste
ActiveDocument.SaveAs "c:\windows\desktop\" &
Capt 'change path here
ActiveDocument.Close
Documents(actName).Activate
End If
Next iShape
''''''''''''''''''

-Ravi
 
N

Nick Transier

Ravi,

Thanks for the help, but one thing to note is that I am using an InlineShape
and not a Shape. The InlineShape objects act differently than the shape
objects.

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top