Can we use the content of a text box variable in the ApplyGUIScript?
We tried
"&text[headertext]"
but it didn't work.

When you use the "template" option

ApplyGUIScript template="..."

the "&text[headertext]" will be replaced correctly in your VB Script.

But there is a problem if the text contains more than one line.

Possible solution: Use the "ReplaceText" command in order to replace CRLF (hex code 0d0a) sequences in  the text by a special string e.g. "~#~", and perform the reverse replacement in the VBScript.