Application.EditCopyPicture method (Project)

Copies the active view as a picture or an OLE object, or exports the active view to a GIF image file.

Syntax

expression. EditCopyPicture( _Object_, _ForPrinter_, _SelectedRows_, _FromDate_, _ToDate_, _FileName_, _ScaleOption_, _MaxImageHeight_, _MaxImageWidth_, _MeasurementUnits_ )

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Object Optional Boolean True if the view should be copied as an OLE object. The default value is False.
ForPrinter Optional Long Specifies where to copy the view. Can be one of the following PjCopyPictureFor constants: pjScreen, pjPrinter, or pjGIF. If Object is True, ForPrinter is ignored. The default value is pjScreen.
SelectedRows Optional Boolean True if Project copies only the selected rows. False if the program copies all visible rows.
FromDate Optional Variant The beginning of the timescale for the copied picture. If Object is True, FromDate is ignored. If FromDate is specified and ToDate is not, Project will use the last entered date for the end of the timescale. If that would create a negative time span, the program will use the latest timescale date visible in the active view. The default value is the earliest timescale date visible in the active view.
ToDate Optional Variant The end of the timescale for the copied picture. If Object is True, ToDate is ignored. If ToDate is specified and FromDate is not, Project will use the last entered date for the beginning of the timescale. If that would create a negative time span, the program will use the earliest timescale date visible in the active view. The default value is the latest timescale date visible in the active view.
FileName Optional String The file name for the GIF image file. If ForPrinter is pjGIF, FileName is required. If Object is True, or ForPrinter is not pjGIF, FileName is ignored.
ScaleOption Optional Long Specifies how to treat a picture of the active view if it is larger than MaxImageWidth by MaxImageHeight (default 22 inches by 22 inches). The default value is pjCopyPictureKeepRange. Can be one of the PjCopyPictureScaleOption constants.
MaxImageHeight Optional Double Specifies the maximum height of the picture. The accepted range of MaxImageHeight is 1 to 22 inches (2.54 to 55.88 centimeters). The default value is 22 (inches).
MaxImageWidth Optional Double Specifies the maximum width of the picture. The accepted range of MaxImageWidth is 1 to 22 inches (2.54 to 55.88 centimeters). The default value is 22 (inches).
MeasurementUnits Optional Variant Long. Specifies the units of measurement. The default value is pjInches. Can be one of the PjMeasurementUnits constants.

Return value

Boolean

Remarks

Using the EditCopyPicture method with no arguments displays the Copy Picture dialog box.

Example

The following example makes a copy of the Gantt Chart view as Test.gif file and saves in the root folder.

Sub Edit_CopyPicture() 
    'Activate the Gantt Chart view 
    ViewApply Name:="&Gantt Chart" 
    EditCopyPicture ForPrinter:=pjGIF, FileName:="C:\Test.gif" 
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.