Table of contents
TOC
Collapse the table of content
Expand the table of content

TextRange.InsertDateTime Method (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

Syntax

expression. InsertDateTime( DateTimeFormat, InsertAsField )

expression A variable that represents a TextRange object.

Parameters

NameRequired/OptionalData TypeDescription
DateTimeFormatRequiredPpDateTimeFormatA format for the date and time.
InsertAsFieldOptionalMsoTriStateDetermines whether the inserted date and time will be updated each time the presentation is opened.

Return Value

TextRange

Remarks

The DateTimeFormat parameter value can be one of these PpDateTimeFormat constants.

|| |:-----| |ppDateTimeddddMMMMddyyyy| |ppDateTimedMMMMyyyy| |ppDateTimedMMMyy| |ppDateTimeFormatMixed| |ppDateTimeHmm| |ppDateTimehmmAMPM| |ppDateTimeHmmss| |ppDateTimehmmssAMPM| |ppDateTimeMdyy| |ppDateTimeMMddyyHmm| |ppDateTimeMMddyyhmmAMPM| |ppDateTimeMMMMdyyyy| |ppDateTimeMMMMyy| |ppDateTimeMMyy| The InsertAsField parameter value can be one of these MsoTriState constants.

ConstantDescription
msoFalseThe default.
msoTrueUpdates 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

See also

Concepts

TextRange Object

© 2018 Microsoft