Sphene Community Tools
Community
Copyright © 2007-2018 by
Herbert Poul
Home
Downloads
Documentation
Forums
Users
Issues
You are not logged in.
Login
Register
Change Language:
German
English
French
Polish
Korean
Russian
where to buy dapoxetine in canada
Sandbox
/
Hehe
[
Edit
]
Back to Snip
Warning:
You are editing an old version: By Anonymous at 2014-02-19 12:09:04
Title:
Body:
剛才測試發現用find物件,execute方法的replaceall引數(即word全部取代功能)果然很慢,若改為下式則快多了:只是我目前還抓不穩range的start 和 end的數值.還須多加測試.關鍵是不要用range去比對,而是先將range的text值賦予一字串變數.我也想過用open for input as 的敘述試試.再說.Sub replacetest0() '2012/6/5Dim a As Range, x As Long, q As StringDim s As Date, e As Date, g, i'Set a = ActiveDocument.Range'Debug.Print Len(a)s = VBA.Timerq = ActiveDocument.Rangex = InStr(q, "翁方綱")'x = InStr(a.Text, "翁方綱")For Each g In ActiveDocument.Comments g.DeleteNextWith ActiveDocument Do Until x = 0' .Range(x - 1, x + 3 - 1).Select .Range(x - 1, x + Len("翁方綱") - 1).Text = "孫守真" i = i + 1' If i = 68 Then Stop x = InStr(x + 1, q, "翁方綱") If .Range(x - 1, x + 3 - 1) <> "翁方綱" Then e = VBA.Timer Debug.Print e - s Debug.Print i Stop End If 'a.Text = Replace(a.Text, "翁方綱", "孫守真") 'a.Find.Execute "翁方綱", , , , , , , , , "孫守真", wdReplaceAll '果然太慢!! LoopEnd Withe = VBA.TimerDebug.Print e - sEnd Sub
Tags:
Comma separated list of tags.
Captcha:
Please enter the result of the above calculation.
Change Message:
*
See
WikiDocumentation
on how to format your input.