you need to use another API GetContent to retreive the value out of the QlikView variable. Here is an example:
set v = ActiveDocument.Variables("Variable1")
In your case, if you'd like to write it all in one line:
ActiveDocument.Fields("Calendar Year"). Select ActiveDocument.Variables("vLastReload").GetContent.String
Just be aware of the Date/Number formatting - what are you expecting to get out of the variable - the number or the formatted string? In order to ensure that you are getting the number, use function num() when you assign the variable in your script.
I have a similar problem. I have one field ReloadDate which carries only the date when the report was reloaded. I need to compare ReloadDate with current date in a macro written using VBScript.. so how can I do that?
I tried with
set dte = ActiveDocument.Fields("ReloadDate").GetPossibleValues
if (dte = Date) then
But the type mismatch error occures. Also tried with
if (dte.item(0) = Date) then
But again "Wrong number of arguments or invalid property assignment: 'dte.item'" error occures.
How to fix the issue??