Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have added a variable called "AverageOfCountry" using "Variable Overview>Add" from Layout. I defined the variable using an expression. How can I evaluate the expression linked to the variable and use it in a macro? I have to use it in a macro because I need the said variable's value on every sheet of the excel document I'm exporting to.
ActiveDocument.GetVariable("AverageOfCountry").getContent.string
and make sure ur variable begins with "=" when created
Maybe with something like:
v = ActiveDocument.Variables("AverageOfCountry").GetContent.String
- Marcus
this will retrieve your variable value
ActiveDocument.GetVariable("AverageOfCountry").GetContent.String
Well it pastes me the expression string in the Excel table, not the value I would get by evaluating the expression. How do I get the variable expression to evaluate?
so set the variable with "=" in front of the expression that the value is calculated.
Regards
ActiveDocument.GetVariable("AverageOfCountry").getContent.string
and make sure ur variable begins with "=" when created
Use "=" at beginning of your variable
Another way might be to use evaluate() for the variable or maybe the expression itself - maybe like this: Re: How to export formula with Set analysis using macro
- Marcus
that's it. Thank you!
Dear all,
i have a similar requirement, am using a macro to export my tables into txt format and want to keep prefix as current date to that generated txt files
i used below F:\Document\$(vDate)_wang.txt --- and it is getting named as it it, it is not picking the current date, Please help me. Thanks much