Class InlineShape (Word VBA)

The class InlineShape represents an object in the text layer of a document. An inline shape can only be a picture, an OLE object, or an ActiveX control. The InlineShape object is a member of the InlineShapes collection. The InlineShapes collection contains all the shapes that appear inline in a document, range, or selection.

The main procedures of class InlineShape are Delete, Select, InlineShapes.AddChart2, InlineShapes.AddHorizontalLine, InlineShapes.AddHorizontalLineStandard, InlineShapes.AddOLEControl, InlineShapes.AddOLEObject, InlineShapes.AddPicture, InlineShapes.AddPictureBullet, InlineShapes.AddSmartArt and InlineShapes.AddWebVideo

Set

To use a InlineShape class variable it first needs to be instantiated, for example

Dim ise as InlineShape
Set ise = ActiveDocument.Range.InlineShapes(Index:=1)

The following procedures can be used to set variables of type InlineShape: Field.InlineShape, InlineShapes.Item, InlineShapes.AddPicture, InlineShapes.New, InlineShapes.Add3DModel, InlineShapes.AddChart2, InlineShapes.AddHorizontalLine, InlineShapes.AddHorizontalLineStandard, InlineShapes.AddOLEControl, InlineShapes.AddOLEObject, InlineShapes.AddPictureBullet, InlineShapes.AddSmartArt, InlineShapes.AddWebVideo, ListFormat.ListPictureBullet, ListLevel.ApplyPictureBullet, ListLevel.PictureBullet, Shape.ConvertToInlineShape, ShapeRange.ConvertToInlineShape, Document.InlineShapes, Range.InlineShapes and Selection.InlineShapes

For Each

Here is an example of processing the InlineShape items in a collection.

Dim ise As InlineShape
For Each ise In ActiveDocument.Range.InlineShapes
	
Next ise

Themes

Some procedures in this class have been grouped together in themes and are described on separate theme pages

Format with its procedures Borders, HorizontalLineFormat, LinkFormat, OLEFormat, ScaleHeight and ScaleWidth
Add with its procedures InlineShapes.Add3DModel, InlineShapes.AddChart2, InlineShapes.AddHorizontalLine, InlineShapes.AddHorizontalLineStandard, InlineShapes.AddOLEControl, InlineShapes.AddOLEObject, InlineShapes.AddPicture, InlineShapes.AddPictureBullet, InlineShapes.AddSmartArt and InlineShapes.AddWebVideo

Methods

These are the main methods of the InlineShape class

Delete - Deletes the specified inline shape.

ActiveDocument.Range.InlineShapes(1).Delete

Select - Selects the specified inline shape.

ActiveDocument.Range.InlineShapes(1).Select

Properties

AlternativeText returns or sets a String that represents the alternative text associated with a shape in a webpage.

ActiveDocument.Range.InlineShapes(1).AlternativeText =

Chart returns a Chart object that represents a chart within the collection of inline shapes in a document.

Dim chrChart As Chart
Set chrChart = ActiveDocument.Range.InlineShapes(1).Chart

Decorative

ActiveDocument.Range.InlineShapes(1).Decorative =

Field returns a Field object that represents the field associated with the specified inline shape.

Dim fldField As Field
Set fldField = ActiveDocument.Range.InlineShapes(1).Field

Fill returns a FillFormat object that contains fill formatting properties for the specified shape.

Dim fftFill As FillFormat
Set fftFill = ActiveDocument.Range.InlineShapes(1).Fill

Glow returns a GlowFormat object that represents the formatting properties for a glow effect.

Dim gftGlow As GlowFormat
Set gftGlow = ActiveDocument.Range.InlineShapes(1).Glow

GraphicStyle

ActiveDocument.Range.InlineShapes(1).GraphicStyle =

GroupItems returns a GroupShapes collection that represents the shapes that are grouped together for an inline shape.

Dim gssGroupItems As GroupShapes
Set gssGroupItems = ActiveDocument.Range.InlineShapes(1).GroupItems

HasChart true if the specified shape is a chart.

Dim mtsHasChart As Office.MsoTriState
mtsHasChart = ActiveDocument.Range.InlineShapes(1).HasChart

HasSmartArt returns True if there is a SmartArt diagram present on the shape.

Dim mtsHasSmartArt As Office.MsoTriState
mtsHasSmartArt = ActiveDocument.Range.InlineShapes(1).HasSmartArt

Height returns or sets the height of an inline shape.

ActiveDocument.Range.InlineShapes(1).Height =

Hyperlink returns a Hyperlink object that represents the hyperlink associated with the specified inline shape.

Dim hypHyperlink As Hyperlink
Set hypHyperlink = ActiveDocument.Range.InlineShapes(1).Hyperlink

IsPictureBullet true indicates that an InlineShape object is a picture bullet.

Dim booIsPictureBullet As Boolean
booIsPictureBullet = ActiveDocument.Range.InlineShapes(1).IsPictureBullet

Line returns a LineFormat object that contains line formatting properties for the specified shape.

Dim lftLine As LineFormat
Set lftLine = ActiveDocument.Range.InlineShapes(1).Line

LockAspectRatio msoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it.

ActiveDocument.Range.InlineShapes(1).LockAspectRatio =

Model3D

Dim mdfModel3D As Model3DFormat
Set mdfModel3D = ActiveDocument.Range.InlineShapes(1).Model3D

Parent returns an object that represents the parent object of the specified InlineShape object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.InlineShapes(1).Parent

PictureFormat returns a PictureFormat object that contains picture formatting properties for the inline shape.

ActiveDocument.Range.InlineShapes(1).PictureFormat =

Range returns a Range object that represents the portion of a document that is contained within an inline shape.

Dim rngRange As Range
Set rngRange = ActiveDocument.Range.InlineShapes(1).Range

Reflection returns a ReflectionFormat object that represents the reflection formatting for a shape.

Dim rftReflection As ReflectionFormat
Set rftReflection = ActiveDocument.Range.InlineShapes(1).Reflection

Script returns a Script object, which represents a block of script or code associated with an image on the specified Web page.

Dim scrScript As Office.Script
scrScript = ActiveDocument.Range.InlineShapes(1).Script

Shadow returns a ShadowFormat object that represents the shadow formatting for the specified shape.

Dim sftShadow As ShadowFormat
Set sftShadow = ActiveDocument.Range.InlineShapes(1).Shadow

SmartArt returns a SmartArt object that provides a way to work with the SmartArt associated with the specified inline shape.

Dim satSmartArt As Office.SmartArt
Set satSmartArt = ActiveDocument.Range.InlineShapes(1).SmartArt

SoftEdge returns a SoftEdgeFormat object that represents the soft edge formatting for a shape.

Dim sefSoftEdge As SoftEdgeFormat
Set sefSoftEdge = ActiveDocument.Range.InlineShapes(1).SoftEdge

TextEffect returns a TextEffectFormat object that contains text-effect formatting properties for the specified inline shape.

ActiveDocument.Range.InlineShapes(1).TextEffect =

Title returns or sets a String that contains a title for the specified inline shape.

ActiveDocument.Range.InlineShapes(1).Title =

Type returns the type of inline shape.

Dim wisType As WdInlineShapeType
wisType = ActiveDocument.Range.InlineShapes(1).Type

Width returns or sets the width, in points, of the specified inline shape.

ActiveDocument.Range.InlineShapes(1).Width =

InlineShapes.Count returns a Long that represents the number of inline shapes in the collection.

Dim lngCount As Long
lngCount = ActiveDocument.Range.InlineShapes.Count

InlineShapes.Parent returns an object that represents the parent object of the specified InlineShapes object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.InlineShapes.Parent