Shapes.Add3DModel method (Excel)

Creates a 3D model from an existing file. Returns a Shape object that represents the new 3D model.

Syntax

expression.Add3DModel (FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
FileName Required String The file from which the 3D model is to be created.
LinkToFile Optional Variant Determines whether the 3D model will be linked to the file from which it was created.
SaveWithDocument Optional Variant Determines whether the linked 3D model will be saved with the document into which it is inserted.
Left Optional Variant The position (in points) of the upper-left corner of the 3D model relative to the upper-left corner of the document.
Top Optional Variant The position (in points) of the upper-left corner of the 3D model relative to the top of the document.
Width Optional Variant The width of the 3D model, in points (enter -1 to auto-calculate a width based on the 3D model dimensions).
Height Optional Variant The height of the 3D model, in points (enter -1 to auto-calculate a height based on the 3D model dimensions).

Return value

Shape

Remarks

The value of the LinkToFile parameter can be one of these MsoTriState constants.

Constant Description
msoCTrue Not supported.
msoFalse To make the 3D model an independent copy of the file.
msoTriStateMixed Not supported.
msoTriStateToggle Not supported.
msoTrue To link the 3D model to the file from which it was created.

The value of the SaveWithDocument parameter can be one of these MsoTriState constants.

Constant Description
msoCTrue Not supported.
msoFalse To store only the link information in the document.
msoTriStateMixed Not supported.
msoTriStateToggle Not supported.
msoTrue To save the linked 3D model with the document into which it is inserted. This argument must be msoTrue if LinkToFile is msoFalse.

Example

This example adds a 3D model created from the file sphere.glb to mySheet. The inserted 3D model is embedded in the active document.

Set mySheet = Application.ActiveWorkbook.ActiveSheet
Set myShape = mySheet.Shapes.Add3DModel(FileName:="c:\my 3d models\sphere.glb", LinkToFile:=False, SaveWithDocument:=True, Left:=100, Top:=100, Width:=70, Height:=70 )

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.