InsertDateTime 方法

       

在指定的文本区域插入日期和时间。返回一个代表所插入文本的 TextRange 对象。

expression.InsertDateTime(DateTimeFormat, InsertAsField)

expression  必选。该表达式返回一个 TextRange 对象。

DateTimeFormat  必选。PpDateTimeFormat 类型。日期和时间格式。

InsertAsField  可选。MsoTriState 类型。决定是否每次打开演示文稿时都更新插入的日期和时间。

示例

本示例将日期和时间插入在活动演示文稿第一张幻灯片第二个形状的第一段第一句之后。

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