VBA Insert Picture, Clip Art, Shape, or Word Art
In VBA insert picture with the following code. The code you will use depends on the type of picture you want to insert.
The 4 most common types of pictures to add are...
1) A picture from a file...
The parameters ", False, True" represent "Link to File" and "Save with Document"
Sub From_File()
Selection.InlineShapes.AddPicture "C:sample.bmp", False, True
End Sub
1) A Clip Art picture ...
Sub From_Clip_Art()
Selection.InlineShapes.AddPicture _
"C:Program FilesMicrosoft OfficeMEDIACAGCAT10j0149627.wmf", _
False, True
End Sub
1) A Shape picture ...
Sub Add_Shape()
ActiveDocument.Shapes.AddPicture("D:Program FilesMicrosoft Office" & _
"MEDIAOFFICE11AutoShapBD18181_.wmf", False, True, , , , , _
Selection.Range).WrapFormat.Type = wdWrapInline
End Sub
And...
4) A Word Art picture ...Sub Word_Art()
ActiveDocument.Shapes.AddTextEffect(msoTextEffect2, "Word Art Text", _
"Arial Black", 36#, msoFalse, msoFalse, 132.35, 352.5).Select
End Sub
Return from VBA Insert Picture to VBA Code Samples
Return to our Homepage

|