Are you selecting the 'value' to pass to the variable in the script or a front end table object?
Via the front-end you'll have to associate it with a variable that remains persistent after the reload has been initiated, conversley within the script you need to tell the variable which is the correct record eg:
Let vMyVariable = peek('MyData',-1,'site');
The above would select the bottom record from the previously loaded table 'MyData'.
Perhaps posting an example file would help matters.
All the best,
Matt - Visual Analytics Ltd
This will take some trial and error but should be doable. Create a macro like the one below (off the top of my head so syntax will probably be off)
Function passVar (strVar)
passVar = ActiveDocument.Variables(chr(34) & strVar & chr(34).GetContent.String
Then in your script use passVar(VariableName)
Might want to try something like
SET vSomething = passVar(VariableName)
I've never done this before quite like this but I don't see why it wouldn't work. I'm not 100% sure about the chr(34) part but I think it's fine (try it in a msg box I guess)
Actually you should just use like the statement below instead of ActiveDocument.Variables(chr(34) & strVar & chr(34).GetContent.String ...
or something like that I don't know the actual syntax off the top of my head so I'm almost certain it's wrong but if you look in the API guide it should be easy to figure out