技術(shù) 點
- 技術(shù)
- 點
- V幣
- 點
- 積分
- 27
|
各位大俠:
有問題想請教,
我用下面兩種代碼做批量替換
第一種如下,它能保持格式的替換,但速度相當(dāng)慢,而且替換時鼠標(biāo)在不停的閃爍
target_doc.Content.Find.Execute findtext:=targetcontent, Replacewith:=replacecontent, Replace:=wdReplaceAll
第二種如下,它能1秒左右替換完畢,但是文檔里面的格式、表格、粘貼圖片都沒了
tbstring = target_doc.Content
tbstring = Replace(tbstring, targetcontent, replacecontent)
為什么有這樣的區(qū)別?
我用第一種方法,做了以下逐條嘗試
With target_doc
.Visible = True
.ActiveWindow.View.Type = wdNormalView
.ScreenUpdating = False
.Options.CheckSpellingAsYouType = False
'.DisplayStatusBar = False 由于詞句在2010版已無效,就沒用
End With
但是都不能提速,所以想問要怎么做才能提速呢?
謝謝!! |
|