Inline Shapes

An inline shape is an object that is in the text layer of the document.
An inline shape can only be a picture, an OLE Object or an ActiveX control.
Represents a object in the text layer of the document.
InlineShapes do not have names.


InlineShape objects are treated like characters and are positioned as characters within a line of text.
The Inlineshapes collection represents all the inline shapes in the document, range or selection.


The Count property for the InLineShapes collection in a document returns the number of shapes in the main story only.
If you want to count the number of inline shapes in other areas then use must use a Range object.


Use the new method to create a new picture as an inline shape
You can use the AddPicture and AddOleObject methods to add pictures or OLE Objects and link them to the source file.
Use the AddOleControl to add an Active X control.


Dim objInlineShape As Word.InlineShape 
Dim objshape As Word.Shape

objShape = objInlineShape.ConvertToShape
objInlineShape = objShape.ConvertToInlineShape

Type Property

Use this property to return the type of the Inline Shape

objInlineShape.Type = wdInlineShapeType.wdInlineShapePicture 



InlineShape Object

The InlineShape object is a member of the InlineShapes collection.
The InlineShapes collection contains all the shapes in a document, range, or selection.


Use InlineShapes(index), where index is the index number, to return a single InlineShape object.
Inline shapes don't have names.
The following example activates the first inline shape in the active document.

ActiveDocument.InlineShapes(1).Activate 

This example saves the linked picture that's defined as the first inline shape in the active document when the document is saved.

Set myPic = ActiveDocument.InlineShapes(1) 
If myPic.Type = wdLinkType.wdInlineShapeLinkedPicture Then
End If


InlineShapes Collection

This represents all the InlineShape objects



Field Property

This example inserts a graphic as an inline shape (using an INCLUDEPICTURE field) and then displays the shape's field code.

Dim ishapeNew As InlineShape 
Set iShapeNew = _
    ActiveDocument.InlineShapes.AddPicture(FileName:="C:\Windows\Tiles.bmp", _
                                           LinkToFile:=True, _
                                           SaveWithDocument:=False, _
                                           Range:=Selection.Range)

MsgBox iShapeNew.Field.Code.Text

IsPictureBullet Property

Indicates if an InlineShape object is a picture bullet. Read-only.
Although picture bullets are considered inline shapes, searching a document's InlineShapes collection will not return picture bullets.
This example formats the selected list if the list if formatted with a picture bullet. If not, a message is displayed.


Public Sub IsSelectionAPictureBullet(shp As InlineShape) 
    On Error GoTo ErrorHandler
    If shp.IsPictureBullet = True Then
            shp.Width = InchesToPoints(0.5)
            shp.Height = InchesToPoints(0.05)
    End If
    Exit Sub
ErrorHandler:
    MsgBox "The selection is not a list or " & _
        "does not contain picture bullets."
End Sub

Use the following code to call the routine above.

Call IsSelectionAPictureBullet(shp:=Selection.Range.ListFormat.ListPictureBullet) 


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext