program speed problem

C

chris

I have a problem with speed differences between 2 VBA programs under excel
XP Pro
The two programs do essentially the same thing up to the point where the
differences in speed occur.
The code segment is

t1=gettickCount
With newBook
.title = stock(jj) & "live analysis"
.SaveAs Filename:=resfn
End With
t2=getTickCount
I have used
Private Declare Function GetTickCount Lib "kernel32" () As Long
to time the progs and up to the start of the with block, the times are
essentially the same. (newbook is open at this stage.)
However, when I time the with block in prog1, the difference between t2 and
t1 is 0 and in prog2, the difference averages 750. Further more as the array
stock(jj) is processed, the difference in prog1 remains 0 but the
differencein prog2 increases, eg ofr jj=1 diff is 750, for jj=2, diff=1015,
for jj=3,diff= 1200 (differences are averages of several runs)
I am running the 2 programs under the ame conditions - they are the only
programs running at the time.

Can anyone tell me what might be the cause of the problem or how I may track
it down and eliminate it?
Thanks
Chris
 
C

chris

Apologies if I have wasted anyone's time but the problem seems to have been
caused by a typo in a path to a directory.

I have corrected that and now the 2 progs run the same. Can't understand why
the wrong directory path would cause this type of behaviour tho.
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top