title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
TextRange.InsertDateTime method (Publisher) |
vbapb10.chm5308453 |
|
|
1d02471a-f22b-7dad-bcbb-40af3a04d198 |
06/15/2019 |
medium |
Returns a TextRange object that represents the date and time inserted into a specified text range.
expression.InsertDateTime (Format, InsertAsField, InsertAsFullWidth, Language, Calendar)
expression A variable that represents a TextRange object.
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. |
TextRange
This example inserts a field for the current date at the cursor position.
Sub InsertDateField()
Selection.TextRange.InsertDateTime Format:=pbDateLong, InsertAsField:=True
End Sub
[!includeSupport and feedback]