找到Word中的"AAA00001"的字串 |
尚未結案
|
norman0219
一般會員 ![]() ![]() 發表:8 回覆:4 積分:2 註冊:2004-07-12 發送簡訊給我 |
此功能是為了要找到Word中的"AAA00001"的字串
但執行時發生錯誤,出現以下訊息 Project test.exe raised exception class EOleException with with message
'虛設常式收到損壞的資料' Process stopped. Use Step or Run to continue. 程式碼如下: FindText:='AAA00001';
MatchCase:=False;
MatchWholeWord:=True;
MatchWildcards:=False;
MatchSoundsLike:=False;
MatchAllWordForms:=False;
DocForward:=False;
Wrap:= wdFindContinue;
Format:=True;
ReplaceWith:='';
Replace:=wdReplaceNone;
MatchKashida:=False;
MatchDiacritics:=False;
MatchAlefHamza:=False;
MatchControl:=False; Word.Selection.Find.Execute(FindText,MatchCase,MatchWholeWord,MatchWildcards, <== 執行發生錯誤
MatchSoundsLike,MatchAllWordForms,DocForward,
Wrap,Format,ReplaceWith,Replace,MatchKashida,
MatchDiacritics,MatchAlefHamza,MatchControl);
|
GE
一般會員 ![]() ![]() 發表:4 回覆:16 積分:14 註冊:2003-01-23 發送簡訊給我 |
var WordApp, WordDoc: Variant; begin WordApp := CreateOleObject('Word.Application'); WordApp.Visible := true; WordDoc := WordApp.Documents.Open('C:\test.doc'); WordApp.Selection.Find.ClearFormatting; WordApp.Selection.Find.Text := 'AAA00001'; WordApp.Selection.Find.Replacement.Text := ''; WordApp.Selection.Find.Forward := true; WordApp.Selection.Find.Wrap := wdFindContinue; WordApp.Selection.Find.Format := false; WordApp.Selection.Find.MatchCase := false; WordApp.Selection.Find.MatchWholeWord := false; WordApp.Selection.Find.MatchByte := true; WordApp.Selection.Find.MatchWildcards := false; WordApp.Selection.Find.MatchSoundsLike := false; WordApp.Selection.Find.MatchAllWordForms := false; WordApp.Selection.Find.Execute; end; |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |