Application.ApplyReportLayoutTemplate method (Project)

Applies the specified report template to the active report.


expression. ApplyReportLayoutTemplate (TemplateId)

expression A variable that represents an Application object.


Name Required/Optional Data type Description
TemplateId Optional PjReportLayoutTemplateId Specifies the kind of report; can be one of the following constants: pjReportLayoutComparison, pjReportLayoutTitleAndChart, pjReportLayoutTitleAndTable, or pjReportLayoutTitleOnly.

Return value



For an existing report, the ApplyReportLayoutTemplate method adds the specified report elements on top of other shapes in the report. For example, if the built-in Task Cost Overview report is active, the ApplyReportLayoutTemplate pjReportLayoutTitleAndChart statement adds a new text box with the report title and a new default chart to the report.


The following example creates a report that contains a title text box and a basic table, and then vertically centers text in the table cells.

Sub CreateTableReport()
    Dim theReport As Report
    Dim reportName As String
    Dim shp As Shape
    ' Add a report.
    reportName = "Table Report"
    Set theReport = ActiveProject.Reports.Add(reportName)
    ApplyReportLayoutTemplate TemplateId:=pjReportLayoutTitleAndTable
    For Each shp In theReport.Shapes
        If shp.HasTable Then
        End If
    Next shp
End Sub

See also

Application Object

Report Object PjReportLayoutTemplateId Enumeration

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.