TextRange.InsertDateTime method (Publisher)
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. Can be one of the PbDateTimeFormat constants declared in the Microsoft Publisher type library. |
InsertAsField | Optional | Boolean | True for Publisher to update date and time whenever opening the publication. The 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. The default is False. |
Language | Optional | MsoLanguageID | The language in which to display the date or time. Can be one of the MsoLanguageID constants declared in the Microsoft Office type library. |
Calendar | Optional | PbCalendarType | The calendar type to use when displaying the date or time. Can be one of the PbCalendarType constants. The default is pbCalendarTypeWestern. |
Return value
TextRange
Example
This example inserts a field for the current date at the cursor position.
Sub InsertDateField()
Selection.TextRange.InsertDateTime Format:=pbDateLong, InsertAsField:=True
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.