Q
Qiang
I have a VB standard exe program as following:
Dim app as new Word.Application
app.Visible = False
Dim doc as Word.Document
Set doc = app.Documents.Open("some word document")
Dim str As Word.Range
StartTime = Time
For i = 1 To 10000
Set str = doc.Range
Next i
EndTime = Time
MsgBox DatedDiff("s",StartTime,EndTime)
doc.Close
Set doc = nothing
app.Quit
Set app = Nothing
It takes 25 senconds to execute this program,o my god,I
don't know why,because if i use macro to run this program
in word document,it takes less than 1 sencond.why the
execution efficiency is so slow?Could anybody tell me how
can i improve the efficiency or what's wrong with my
program.thank you very much
Dim app as new Word.Application
app.Visible = False
Dim doc as Word.Document
Set doc = app.Documents.Open("some word document")
Dim str As Word.Range
StartTime = Time
For i = 1 To 10000
Set str = doc.Range
Next i
EndTime = Time
MsgBox DatedDiff("s",StartTime,EndTime)
doc.Close
Set doc = nothing
app.Quit
Set app = Nothing
It takes 25 senconds to execute this program,o my god,I
don't know why,because if i use macro to run this program
in word document,it takes less than 1 sencond.why the
execution efficiency is so slow?Could anybody tell me how
can i improve the efficiency or what's wrong with my
program.thank you very much