Changing Starting Position of a Motion Study Component

I'm trying to repeat a motion study (Basic Motion, not Motion Analysis) using the API, so that the motion study calculates once, copies the end position of a component, and then calculates another motion study with the start position of that component set to what I copied from its end position.  (I.e. I want the 2nd motion study to start where the 1st one left off in terms of that component's position, and the 3rd to start where the 2nd left off, etc.)

Unfortunately, it seems that I'm having no such luck.  Basically, my VBA code looks like this:

swMotionStudy.calculate

swMotionStudy.SetTime (swMotionStudy.GetDuration)

Set BotTransform = swAssy.GetComponentByName("RTBot1-3").Transform2

swMotionStudy.SetTime(0#)

swAssy.GetComponentByName("RTBot1-3").Transform2 = BotTransform

The code is run in a loop.  I would expect this to work, but for some reason the starting position of the component never changes; each iteration looks identical to the previous one.

Anyone see something obviously wrong with my code?  I'm probably making a noob error; any help would be appreciated.

Thanks,

-Jeremy Rand

Norman North High School Robotics Team

SolidworksApi macros