ShapeRange.SaveAsPicture method (Publisher)
Saves a range of one or more shapes as a picture file.
Syntax
expression.SaveAsPicture (FileName, pbResolution)
expression A variable that represents a ShapeRange object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
FileName | Required | String | The path and file name of the new picture file that you want to create. The graphics format that the picture is saved in is determined by the file name extension (such as .jpg or .gif) that you specify. |
pbResolution | Optional | PbPictureResolution | The resolution in which you want the picture to be saved. Can be one of the PbPictureResolution constants. |
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAsPicture method to save all the shapes on the first page of the active publication as a .jpg picture file.
Before running this code, replace filename.jpg
with a valid file name and the path to a folder on your computer where you have permission to save files.
Public Sub SaveAsPicture_Example()
Dim pubShapeRange As Publisher.ShapeRange
Set pubShapeRange = ThisDocument.Pages(1).Shapes.Range
pubShapeRange.SaveAsPicture "filename.jpg"
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.