Word VBA教程:ActiveWritingStyle属性

返回或设置指定文档中指定语言的写作风格。String 类型,可读写。

注意  WritingStyleList属性返回一个所有可用的写作风格名称的数组。

expression.ActiveWritingStyle(LanguageID)

expression   必需。该表达式返回一个Document对象。

LanguageID   Variant 类型,必需。在指定文档中要设置写作风格的语言。可以是一个字符串或下列WdLanguageID 常量之一。

WdLanguageID 可以是下列 WdLanguageID 常量之一:
wdAfrikaans
wdAlbanian
wdArabic
wdArabicAlgeria
wdArabicBahrain
wdArabicEgypt
wdArabicIraq
wdArabicJordan
wdArabicKuwait
wdArabicLebanon
wdArabicLibya
wdArabicMorocco
wdArabicOman
wdArabicQatar
wdArabicSyria
wdArabicTunisia
wdArabicUAE
wdArabicYemen
wdArmenian
wdAssamese
wdAzeriCyrillic
wdAzeriLatin
wdBasque
wdBelgianDutch
wdBelgianFrench
wdBengali
wdBosniaHerzegovina
wdBrazilianPortuguese
wdBulgarian
wdBurmese
wdByelorussian
wdCatalan
wdChineseHongKong
wdChineseMacao
wdChineseSingapore
wdCroatian
wdCzech
wdDanish
wdDutch
wdEnglishAUS
wdEnglishBelize
wdEnglishCanadian
wdEnglishCaribbean
wdEnglishIreland
wdEnglishJamaica
wdEnglishNewZealand
wdEnglishPhilippines
wdEnglishSouthAfrica
wdEnglishTrinidad
wdEnglishUK
wdEnglishUS
wdEnglishZimbabwe
wdEstonian
wdFaeroese
wdFarsi
wdFinnish
wdFrench
wdFrenchCameroon
wdFrenchCanadian
wdFrenchCotedIvoire
wdFrenchLuxembourg
wdFrenchMali
wdFrenchMonaco
wdFrenchReunion
wdFrenchSenegal
wdFrenchWestIndies
wdFrenchZaire
wdFrisianNetherlands
wdGaelicIreland
wdGaelicScotland
wdGalician
wdGeorgian
wdGerman
wdGermanAustria
wdGermanLiechtenstein
wdGermanLuxembourg
wdGreek
wdGujarati
wdHebrew
wdHindi
wdHungarian
wdIcelandic
wdIndonesian
wdItalian
wdJapanese
wdKannada
wdKashmiri
wdKazakh
wdKhmer
wdKirghiz
wdKonkani
wdKorean
wdLanguageNone
wdLao
wdLatvian
wdLithuanian
wdLithuanianClassic
wdMacedonian
wdMalayalam
wdMalayBruneiDarussalam
wdMalaysian
wdMaltese
wdManipuri
wdMarathi
wdMexicanSpanish
wdMongolian
wdNepali
wdNoProofing
wdNorwegianBokmol
wdNorwegianNynorsk
wdOriya
wdPolish
wdPortuguese
wdPunjabi
wdRhaetoRomanic
wdRomanian
wdRomanianMoldova
wdRussian
wdRussianMoldova
wdSamiLappish
wdSanskrit
wdSerbianCyrillic
wdSerbianLatin
wdSesotho
wdSimplifiedChinese
wdSindhi
wdSlovak
wdSlovenian
wdSorbian
wdSpanish
wdSpanishArgentina
wdSpanishBolivia
wdSpanishChile
wdSpanishColombia
wdSpanishCostaRica
wdSpanishDominicanRepublic
wdSpanishEcuador
wdSpanishElSalvador
wdSpanishGuatemala
wdSpanishHonduras
wdSpanishModernSort
wdSpanishNicaragua
wdSpanishPanama
wdSpanishParaguay
wdSpanishPeru
wdSpanishPuertoRico
wdSpanishUruguay
wdSpanishVenezuela
wdSutu
wdSwahili
wdSwedish
wdSwedishFinland
wdSwissFrench
wdSwissGerman
wdSwissItalian
wdTajik
wdTamil
wdTatar
wdTelugu
wdThai
wdTibetan
wdTraditionalChinese
wdTsonga
wdTswana
wdTurkish
wdTurkmen
wdUkrainian
wdUrdu
wdUzbekCyrillic
wdUzbekLatin
wdVenda
wdVietnamese
wdWelsh
wdXhosa
wdZulu

说明

由于您选择或安装的语言支持不同,例如,英语(美国),上述部分常量可能无法使用。

VBA示例

本示例设置活动文档中法语、德语和美国英语的写作风格。若要运行本示例,必须安装法语、德语和美国英语的语法文件。


With ActiveDocument
    .ActiveWritingStyle(wdFrench) = "Commercial"
    .ActiveWritingStyle(wdGerman) = "Technisch/Wiss"
    .ActiveWritingStyle(wdEnglishUS) = "Technical"
End With

本示例返回所选内容的语言的写作风格。


Sub WhichLanguage()
    Dim varLang As Variant
    varLang = Selection.LanguageID
    MsgBox ActiveDocument.ActiveWritingStyle(varLang)
End Sub

Word VBA参考教程