Share via


Application.FilePageSetupLegend Method

Project Developer Reference

Sets up legends for printing.

Syntax

expression.FilePageSetupLegend(Name, TextWidth, LegendOn, Alignment, Text, LabelFontName, LabelFontSize, LabelFontBold, LabelFontItalic, LabelFontUnderline, LabelFontColor)

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
Name Optional String The name of the view or report for which to set up legends for printing.
TextWidth Optional Integer The width of the text, in inches or centimeters.
LegendOn Optional Long The pages on which the legend appears. Can be one of the following PjLegend constants: pjNoLegend, pjAfterLastPage, or pjOnEveryPage.
Alignment Optional Long The alignment of the text in the legend. Can be one of the following PjAlignment constants: pjLeft, pjCenter, or pjRight. The default value is pjCenter.
Text Optional String The text to display in the legend. The following special format codes may be included as part of the legend:
Format CodeDescription
&BTurns bold printing on or off.
&ITurns italic printing on or off.
&UTurns underline printing on or off.
&""fontname""Prints characters that follow the format code in the specified font. An example would be &""Arial"".
&nnPrints characters that follow the format code in the specified font size. Use a two-digit number to specify a size in points. An example would be &08.
&P""path""Inserts the specified image. An example would be &P""[My Documents]\Image.gif"". The term [My Documents] represents the full path to your My Documents folder.
&[Date]Prints the current system date.
&[Time]Prints the current system time.
&[File]Prints the file name.
&[Page]Prints the page number.
&[Pages]Prints the total number of pages in the document.
&[Project Title]Prints the title.
&[Company]Prints the company name.
&[Manager]Prints the manager name.
&[Start Date]Prints the project start date.
&[Finish Date]Prints the project finish date.
&[Current Date]Prints the project current date.
&[Status Date]Prints the project status date.
&[View]Prints the view name.
&[Report]Prints the report name.
&[Filter]Prints the filter name.
&[Saved Date]Prints the last saved date.
&[Subject]Prints the subject.
&[Author]Prints the author.
&[Keyword]Prints the keyword(s).
&[Field_Name]Prints the value of the field specified with Field_Name. If a macro will be run in more than one language, the field specified with Field_Name must use the name localized for each language. An example would be &[Actual Cost].
Format Code Description
&B Turns bold printing on or off.
&I Turns italic printing on or off.
&U Turns underline printing on or off.
&""fontname"" Prints characters that follow the format code in the specified font. An example would be &""Arial"".
&nn Prints characters that follow the format code in the specified font size. Use a two-digit number to specify a size in points. An example would be &08.
&P""path"" Inserts the specified image. An example would be &P""[My Documents]\Image.gif"". The term [My Documents] represents the full path to your My Documents folder.
&[Date] Prints the current system date.
&[Time] Prints the current system time.
&[File] Prints the file name.
&[Page] Prints the page number.
&[Pages] Prints the total number of pages in the document.
&[Project Title] Prints the title.
&[Company] Prints the company name.
&[Manager] Prints the manager name.
&[Start Date] Prints the project start date.
&[Finish Date] Prints the project finish date.
&[Current Date] Prints the project current date.
&[Status Date] Prints the project status date.
&[View] Prints the view name.
&[Report] Prints the report name.
&[Filter] Prints the filter name.
&[Saved Date] Prints the last saved date.
&[Subject] Prints the subject.
&[Author] Prints the author.
&[Keyword] Prints the keyword(s).
&[Field_Name] Prints the value of the field specified with Field_Name. If a macro will be run in more than one language, the field specified with Field_Name must use the name localized for each language. An example would be &[Actual Cost].
LabelFontName Optional String The name of the font.
LabelFontSize Optional Integer The size of the font in points.
LabelFontBold Optional Boolean True if the font is bold.
LabelFontItalic Optional Boolean True if the font is italic.
LabelFontUnderline Optional Boolean True if the font is underlined.
LabelFontColor Optional Long The color of the font. Can be one the following PjColor constants:
pjColorAutomaticpjNavy
pjAquapjOlive
pjBlackpjPurple
pjBluepjRed
pjFuchsiapjSilver
pjGraypjTeal
pjGreenpjYellow
pjLimepjWhite
pjMaroon
pjColorAutomatic pjNavy
pjAqua pjOlive
pjBlack pjPurple
pjBlue pjRed
pjFuchsia pjSilver
pjGray pjTeal
pjGreen pjYellow
pjLime pjWhite
pjMaroon

Return Value
Boolean

Remarks

Using the FilePageSetupLegend method without specifying any arguments displays the Page Setup dialog box with the Legend tab selected.

Example
The following example sets up a legend for printing.

Visual Basic for Applications
  Sub SetLegend()

Dim strLegend As String

strLegend = GetFontFormatCode("Arial") strLegend = strLegend & "&BThis text will appear in the legend.&B"

Application.FilePageSetupLegend Text:=strLegend, _ Alignment:=pjCenter, LegendOn:=pjOnEveryPage End Sub

Public Function GetFontFormatCode(strFontName As String) As String

GetFontFormatCode = "&" & Chr(34) & strFontName & Chr(34) End Function

See Also