Share via


InsertDateTime Method

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

expression**.InsertDateTime(DateTimeFormat**, InsertAsField)

*expression   * Required. An expression that returns a TextRange object.

PpDateTimeFormat

PpDateTimeFormat can be one of these PpDateTimeFormat constants.
ppDateTimeddddMMMMddyyyy
ppDateTimedMMMMyyyy
ppDateTimedMMMyy
ppDateTimeFormatMixed
ppDateTimeHmm
ppDateTimehmmAMPM
ppDateTimeHmmss
ppDateTimehmmssAMPM
ppDateTimeMdyy
ppDateTimeMMddyyHmm
ppDateTimeMMddyyhmmAMPM
ppDateTimeMMMMdyyyy
ppDateTimeMMMMyy
ppDateTimeMMyy

MsoTriState

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse Default.
msoTriStateMixed
msoTriStateToggle
msoTrue Updates the inserted date and time each time the presentation is opened.

Example

This example inserts the date and time after the first sentence of the first paragraph in shape two on slide one in the active presentation.

Set sh = Application.ActivePresentation.Slides(1).Shapes(2)
Set sentOne = sh.TextFrame.TextRange.Paragraphs(1).Sentences(1)
sentOne.InsertAfter.InsertDateTime ppDateTimeMdyy

Applies to | TextRange Object

See Also | InsertAfter Method | InsertBefore Method | InsertSlideNumber Method | InsertSymbol Method