Charles Williams said:
OK, I didnt understand several words in that.
How about some more clues for a Mac novice?
Sorry, Charles -
MacScript() is a VBA method that executes an Applescript script and
returns the result of the script.
OSAX is Open Scripting Architecture eXtension - also called a Scripting
Addition - compiled C/C++/etc code that can be called in Applescript.
Applescript is MacOS's natural-language scripting language.
So in VBA I wrap the code I'm timing with calls to an Applescript that
returns the system clock since startup in milliseconds:
Dim time1 as double, time2 as double
Dim i As Long
time1 = MacScript("GetMilliSec")
for i = 1 to 10000
'Do something
next i
time2 = MacScript("GetMilliSec")
MsgBox "Loop took " & time2 - time1 & " milliseconds."
the major problem with this method is that the function call obviously
takes time, so I usually use a null loop as a tare.
Also, OS X being a preemptive multitasking system, the results will vary
depending on how many other processes are running. When XL is the only
user app running and it's reniced to -20 the results are pretty
consistent, with an effective resolution of perhaps 10 milliseconds. If
you have other apps running the results can be wildly inconsistent, with
resolution no better than 250 milliseconds.
Since the PowerPC has a microsecond timer available, I've been telling
myself for years now that I'm going to write an API call to deliver
microsecond resolution to VBA. For some reason, I've always had more
important/urgent projects, though.