标签: word-style

VBA Word - Apply a style to a line of text

I'm trying to apply a word style to a line of text using vba, so that it will appear in the table of contents. I am having trouble keeping the style contained to the line in question though, for some reason the whole document is picking up the style.

With Selection
.TypeText Text:=headername                 ' This is defined previously,
.HomeKey Unit:=wdLine, Extend:=wdMove   ' This is to move the cursor to the start of the line
.Expand wdLine                           ' This is to …
Run Code Online (Sandbox Code Playgroud)

vba ms-word word-style

0
推荐指数
1
解决办法
8991
查看次数

标签 统计

ms-word ×1

vba ×1

word-style ×1