HI,
Ok. Got your point, sorry...
As i wrote - not familiar with VBA but as JS it could be like this:
var doc = app.activeDocument, destCell, currFile, currRec, currImage, i, mVarA = doc.textVariables.item("variableA"), mVarB = doc.textVariables.item("variableB"), mVarAinst = mVarA.associatedInstances, len = mVarAinst.length; while (len-->0) mVarAinst[len].associatedTextVariable = mVarB;
mVarAinst is an array of varA instances ==> no need to search them across entire doc
Jarek