TextRange.InsertDateTime Method

Publisher Developer Reference

Returns a TextRange object that represents the date and time inserted into a specified text range.

Syntax

expression.InsertDateTime(Format, InsertAsField, InsertAsFullWidth, Language, Calendar)

expression   A variable that represents a TextRange object.

Parameters

Name Required/Optional Data Type Description
Format Required PbDateTimeFormat A format for the date and time.
InsertAsField Optional Boolean True for Microsoft Office Publisher to update date and time whenever opening the publication. Default is False.
InsertAsFullWidth Optional Boolean True to insert the specified information as double-byte digits. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed. Default is False.
Language Optional MsoLanguageID The language in which to display the date or time.
Calendar Optional PbCalendarType The calendar type to use when displaying the date or time.

Return Value
TextRange

Remarks

The Format parameter can be one of the PbDateTimeFormat constants declared in the Microsoft Office Publisher type library.

The Language parameter can be one of the MsoLanguageID constants declared in the Microsoft Office type library.

The Calendar parameter can be one of the PbCalendarType constants declared in the Microsoft Office Publisher type library. The default is pbCalendarTypeWestern.

Example

This example inserts a field for the current date at the cursor position.

Visual Basic for Applications
  Sub InsertDateField()
    Selection.TextRange.InsertDateTime Format:=pbDateLong, InsertAsField:=True
End Sub

See Also