2 Replies Latest reply: Jan 2, 2015 1:23 PM by Rob Wunderlich RSS

    Using Variables in Function to Set Chart Title

      Hi Folks,


      I'm trying to set my chart title name by using a vbscript function


      Function GetMyChartName()

      GetMyChartName = "Bob"

      End Function


      In the Chart->Properties->Window Title I have

      = GetMyChartName


      This works and my chart title is Bob.


      However, I want to use a variable for the chart name (This has already been set up as PresetVariable in the Variable Overview screen) so instead my function would be:


      Function GetMyChartName()

      dim var_value

      var_value = ActiveDocument.Variables("PresetVariable").GetContent.string


      GetMyChartName = var_value

      end function


      This does not work and it's the ActiveDocument line that is causing it to fail.


      Can anyone shed any light on why?