Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.ApplyReportLayoutTemplate Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Applies the specified report template to the active report.

Syntax

expression. ApplyReportLayoutTemplate(TemplateId)

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData typeDescription
TemplateIdOptionalPjReportLayoutTemplateIdSpecifies the kind of report; can be one of the following constants: pjReportLayoutComparison, pjReportLayoutTitleAndChart, pjReportLayoutTitleAndTable, or pjReportLayoutTitleOnly.
TemplateIdOptionalPJREPORTLAYOUTTEMPLATEID

Return value

Boolean

Remarks

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.

Example

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
            shp.Select
            AlignTableCellVerticalCenter
        End If
    Next shp
End Sub

See also

Concepts

Application Object

Other resources

Report ObjectPjReportLayoutTemplateId Enumeration

© 2018 Microsoft