Share via


InsertDateTime Method

InsertDateTime Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

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

expression.InsertDateTime(Format, InsertAsField, InsertAsFullWidth, Language, Calendar)

expression   Required. An expression that returns a TextRange object.

PbDateTimeFormat

PbDateTimeFormat can be one of these PbDateTimeFormat constants.
pbDateEnglish
pbDateISO
pbDateLong
pbDateLongDay
pbDateMon_Yr
pbDateMonthYr
pbDateShort
pbDateShortAbb
pbDateShortAlt
pbDateShortMon
pbDateShortSlash
pbDateTimeEastAsia1
pbDateTimeEastAsia2
pbDateTimeEastAsia3
pbDateTimeEastAsia4
pbDateTimeEastAsia5
pbTime24
pbTimeDatePM
pbTimeDateSecPM
pbTimePM
pbTimeSec24
pbTimeSecPM

InsertAsField  Optional Boolean. True for Microsoft Publisher to update date and time whenever opening the publication. 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’ve selected or installed. Default is False.

MsoLanguageID

MsoLanguageID can be one of these MsoLanguageID constants.
msoLanguageIDAfrikaans
msoLanguageIDAlbanian
msoLanguageIDAmharic
msoLanguageIDArabic
msoLanguageIDArabicAlgeria
msoLanguageIDArabicBahrain
msoLanguageIDArabicEgypt
msoLanguageIDArabicIraq
msoLanguageIDArabicJordan
msoLanguageIDArabicKuwait
msoLanguageIDArabicLebanon
msoLanguageIDArabicLibya
msoLanguageIDArabicMorocco
msoLanguageIDArabicOman
msoLanguageIDArabicQatar
msoLanguageIDArabicSyria
msoLanguageIDArabicTunisia
msoLanguageIDArabicUAE
msoLanguageIDArabicYemen
msoLanguageIDArmenian
msoLanguageIDAssamese
msoLanguageIDAzeriCyrillic
msoLanguageIDAzeriLatin
msoLanguageIDBasque
msoLanguageIDBelgianDutch
msoLanguageIDBelgianFrench
msoLanguageIDBengali
msoLanguageIDBrazilianPortuguese
msoLanguageIDBulgarian
msoLanguageIDBurmese
msoLanguageIDByelorussian
msoLanguageIDCatalan
msoLanguageIDCherokee
msoLanguageIDChineseHongKong
msoLanguageIDChineseMacao
msoLanguageIDChineseSingapore
msoLanguageIDCroatian
msoLanguageIDCzech
msoLanguageIDDanish
msoLanguageIDDivehi
msoLanguageIDDutch
msoLanguageIDEdo
msoLanguageIDEnglishAUS
msoLanguageIDEnglishBelize
msoLanguageIDEnglishCanadian
msoLanguageIDEnglishCaribbean
msoLanguageIDEnglishIreland
msoLanguageIDEnglishJamaica
msoLanguageIDEnglishNewZealand
msoLanguageIDEnglishPhilippines
msoLanguageIDEnglishSouthAfrica
msoLanguageIDEnglishTrinidad
msoLanguageIDEnglishUK
msoLanguageIDEnglishUS
msoLanguageIDEnglishZimbabwe
msoLanguageIDEstonian
msoLanguageIDFaeroese
msoLanguageIDFarsi
msoLanguageIDFilipino
msoLanguageIDFinnish
msoLanguageIDFrench
msoLanguageIDFrenchCameroon
msoLanguageIDFrenchCanadian
msoLanguageIDFrenchCotedIvoire
msoLanguageIDFrenchLuxembourg
msoLanguageIDFrenchMali
msoLanguageIDFrenchMonaco
msoLanguageIDFrenchReunion
msoLanguageIDFrenchSenegal
msoLanguageIDFrenchWestIndies
msoLanguageIDFrenchZaire
msoLanguageIDFrisianNetherlands
msoLanguageIDFulfulde
msoLanguageIDGaelicIreland
msoLanguageIDGaelicScotland
msoLanguageIDGalician
msoLanguageIDGeorgian
msoLanguageIDGerman
msoLanguageIDGermanAustria
msoLanguageIDGermanLiechtenstein
msoLanguageIDGermanLuxembourg
msoLanguageIDGreek
msoLanguageIDGuarani
msoLanguageIDGujarati
msoLanguageIDHausa
msoLanguageIDHawaiian
msoLanguageIDHebrew
msoLanguageIDHindi
msoLanguageIDHungarian
msoLanguageIDIbibio
msoLanguageIDIcelandic
msoLanguageIDIgbo
msoLanguageIDIndonesian
msoLanguageIDInuktitut
msoLanguageIDItalian
msoLanguageIDJapanese
msoLanguageIDKannada
msoLanguageIDKanuri
msoLanguageIDKashmiri
msoLanguageIDKazakh
msoLanguageIDKhmer
msoLanguageIDKirghiz
msoLanguageIDKonkani
msoLanguageIDKorean
msoLanguageIDKyrgyz
msoLanguageIDLao
msoLanguageIDLatin
msoLanguageIDLatvian
msoLanguageIDLithuanian
msoLanguageIDMacedonian
msoLanguageIDMalayalam
msoLanguageIDMalayBruneiDarussalam
msoLanguageIDMalaysian
msoLanguageIDMaltese
msoLanguageIDManipuri
msoLanguageIDMarathi
msoLanguageIDMexicanSpanish
msoLanguageIDMixed
msoLanguageIDMongolian
msoLanguageIDNepali
msoLanguageIDNonedefault
msoLanguageIDNoProofing
msoLanguageIDNorwegianBokmol
msoLanguageIDNorwegianNynorsk
msoLanguageIDOriya
msoLanguageIDOromo
msoLanguageIDPashto
msoLanguageIDPolish
msoLanguageIDPortuguese
msoLanguageIDPunjabi
msoLanguageIDRhaetoRomanic
msoLanguageIDRomanian
msoLanguageIDRomanianMoldova
msoLanguageIDRussian
msoLanguageIDRussianMoldova
msoLanguageIDSamiLappish
msoLanguageIDSanskrit
msoLanguageIDSerbianCyrillic
msoLanguageIDSerbianLatin
msoLanguageIDSesotho
msoLanguageIDSimplifiedChinese
msoLanguageIDSindhi
msoLanguageIDSindhiPakistan
msoLanguageIDSinhalese
msoLanguageIDSlovak
msoLanguageIDSlovenian
msoLanguageIDSomali
msoLanguageIDSorbian
msoLanguageIDSpanish
msoLanguageIDSpanishArgentina
msoLanguageIDSpanishBolivia
msoLanguageIDSpanishChile
msoLanguageIDSpanishColombia
msoLanguageIDSpanishCostaRica
msoLanguageIDSpanishDominicanRepublic
msoLanguageIDSpanishEcuador
msoLanguageIDSpanishElSalvador
msoLanguageIDSpanishGuatemala
msoLanguageIDSpanishHonduras
msoLanguageIDSpanishModernSort
msoLanguageIDSpanishNicaragua
msoLanguageIDSpanishPanama
msoLanguageIDSpanishParaguay
msoLanguageIDSpanishPeru
msoLanguageIDSpanishPuertoRico
msoLanguageIDSpanishUruguay
msoLanguageIDSpanishVenezuela
msoLanguageIDSutu
msoLanguageIDSwahili
msoLanguageIDSwedish
msoLanguageIDSwedishFinland
msoLanguageIDSwissFrench
msoLanguageIDSwissGerman
msoLanguageIDSwissItalian
msoLanguageIDSyriac
msoLanguageIDTajik
msoLanguageIDTamazight
msoLanguageIDTamazightLatin
msoLanguageIDTamil
msoLanguageIDTatar
msoLanguageIDTelugu
msoLanguageIDThai
msoLanguageIDTibetan
msoLanguageIDTigrignaEritrea
msoLanguageIDTigrignaEthiopic
msoLanguageIDTraditionalChinese
msoLanguageIDTsonga
msoLanguageIDTswana
msoLanguageIDTurkish
msoLanguageIDTurkmen
msoLanguageIDUkrainian
msoLanguageIDUrdu
msoLanguageIDUzbekCyrillic
msoLanguageIDUzbekLatin
msoLanguageIDVenda
msoLanguageIDVietnamese
msoLanguageIDWelsh
msoLanguageIDXhosa
msoLanguageIDYi
msoLanguageIDYiddish
msoLanguageIDYoruba
msoLanguageIDZulu

PbCalendarType

PbCalendarType can be one of these PbCalendarType constants.
pbCalendarTypeArabicHijri
pbCalendarTypeChineseNational
pbCalendarTypeHebrewLunar
pbCalendarTypeJapaneseEmperor
pbCalendarTypeKoreanDanki
pbCalendarTypeSakaEra
pbCalendarTypeThaiBuddhist
pbCalendarTypeTranslitEnglish
pbCalendarTypeTranslitFrench
pbCalendarTypeWesterndefault

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