ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   program speed problem (https://www.excelbanter.com/excel-programming/276698-program-speed-problem.html)

chris[_3_]

program speed problem
 
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



chris[_3_]

program speed problem
 
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
"chris" wrote in message
u...
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






All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com