首先在word模板"abc.dot"中建立一個名為"line"的書簽。
dim appWord as new Word.Application
With appWord
.documents.add "c:\abc.dot"
.selection.goto wdgotobookmark,name:="line"
.visible=true
end with
'循環(huán)取出數(shù)據(jù)庫中的記錄,插入到文檔的書簽位置。
do until rst.eof
appword.selection.typetext rst("字段名")
rst.movenext
loop