Muokkaa

Jaa


Shapes.Add3DModel method (Word)

Adds a 3D model to a drawing canvas. Returns a Shape object that represents the 3D model and adds it to the CanvasShapes collection.

Syntax

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

expression Required. A variable that represents a Shapes collection.

Parameters

Name Required/Optional Data type Description
FileName Required String The path and file name of the 3D model.
LinkToFile Optional Variant True to link the 3D model to the file from which it was created. False to make the 3D model an independent copy of the file. The default value is False.
SaveWithDocument Optional Variant True to save the linked 3D model with the document. The default value is False.
Left Optional Variant The position, measured in points, of the left edge of the new 3D model relative to the drawing canvas.
Top Optional Variant The position, measured in points, of the top edge of the new 3D model relative to the drawing canvas.
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

Example

This example embeds a 3D model in a newly created drawing canvas in the active document.

Sub NewCanvasPicture() 
 Dim shpCanvas As Shape 
 
 'Add a drawing canvas to the active document 
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas(Left:=100, Top:=75, Width:=200, Height:=300)
 
 'Add a 3D model to the drawing canvas 
 shpCanvas.CanvasItems.Add3DModel(FileName:="c:\my 3D models\sphere.glb", LinkToFile:=False, SaveWithDocument:=True, Left:=100, Top:=100, Width:=70, Height:=70)
End Sub

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.