CanvasShapes.AddPicture Method
Creates a picture from an existing file. Returns a CanvasShapes object that represents the new picture.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
Function AddPicture ( _
FileName As String, _
LinkToFile As MsoTriState, _
SaveWithDocument As MsoTriState, _
Left As Single, _
Top As Single, _
Width As Single, _
Height As Single _
) As Shape
'Usage
Dim instance As CanvasShapes
Dim FileName As String
Dim LinkToFile As MsoTriState
Dim SaveWithDocument As MsoTriState
Dim Left As Single
Dim Top As Single
Dim Width As Single
Dim Height As Single
Dim returnValue As Shape
returnValue = instance.AddPicture(FileName, _
LinkToFile, SaveWithDocument, Left, _
Top, Width, Height)
Shape AddPicture(
string FileName,
MsoTriState LinkToFile,
MsoTriState SaveWithDocument,
float Left,
float Top,
float Width,
float Height
)
Parameters
- FileName
Type: System.String
The file from which the OLE object is to be created.
- LinkToFile
Type: Microsoft.Office.Core.MsoTriState
Determines whether the picture will be linked to the file from which it was created.
- SaveWithDocument
Type: Microsoft.Office.Core.MsoTriState
Determines whether the linked picture will be saved with the document into which it is inserted. This argument must be msoTrue if LinkToFile is msoFalse.
- Left
Type: System.Single
The position, measured in points, of the left edge of the picture relative to the left edge of the slide.
- Top
Type: System.Single
The position, measured in points, of the top edge of the picture relative to the top edge of the slide.
- Width
Type: System.Single
The width of the picture, measured in points.
- Height
Type: System.Single
The height of the picture, measured in points.
Return Value
Type: Microsoft.Office.Interop.PowerPoint.Shape
Shape
Examples
This example adds a picture created from the file Music.bmp to myDocument. The inserted picture is linked to the file from which it was created and is saved with myDocument.
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddPictureFileName:="c:\microsoft office\" & _
"clipart\music.bmp", LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, _
Left:=100, Top:=100, Width:=70, Height:=70