.插入或替換操作
()替換數據法
string ls_find_stringls_replace_string
//取數據庫中數據賦值變量ls_replace_string(程序略)
ls_find_string = student_name
ls_replace_string = 張某 ole_WordobjectapplicationSelectionfindExecute (ls_find_stringfalsetruefalsefalsefalsetruetruels_replace_string)
//替換student_yeardepartmentstudent_id的程序與替換student_name相同略
其運行結果如圖所示
()插入數據法
除了使用查找替換方式您還可以使用書簽方式來實現上述操作
string ls_namels_yeardepartmentls_id
//取數據庫中數據賦值變量ls_namels_yeardepartmentls_id(程序略)
IF ole_WordobjectapplicationActiveDocumentBookmarksExists(name) THEN
ole_Wordobjectapplicationactivedocumentbookmarksitem(name)select
//定位書簽name
ole_Wordobjectapplicationselectiontypetext(ls_name)
//插入值
for i = to
//消除非法字符
ole_WordobjectapplicationSelectionTypeBackspace()
next
ELSE//錯誤提示
END IF
//定位書簽yeardepartmentid一樣略
[] [] []
From:http://tw.wingwit.com/Article/program/PB/201311/24578.html