<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using certain excel functions via macro - setsourcedata in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-certain-excel-functions-via-macro-setsourcedata/m-p/726912#M260586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are required at times to write macros in QlikView to create custom excel files.&amp;nbsp; I run into issues where the I cannot get the syntax to work to do certain excel tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example commands that require := values sent as parameters where the parameter is not an excel constant.&lt;/P&gt;&lt;P&gt;A specific example I have is attempting to set the source data on an existing chart in the excel document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The microsoft help shows this as (with PlotBy being optional- I am not passing it in):&lt;/P&gt;&lt;P&gt;Charts(1).SetSourceData Source:=Sheets("NA").Range("a1:a10"), PlotBy:=xlColumns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing this manually in excel and recording the macro provides:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveSheet.ChartObjects("Chart 2").Activate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveChart.PlotArea.Select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveChart.SetSourceData &lt;STRONG&gt;Source:=Sheets&lt;/STRONG&gt;("NA").Range("E3:M3,E6:M6")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I handle the Source:=Sheets(1).Range("a1:a10") in the QlikView macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I have tried a variety of things to no avail.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;1) assign the sheets("NA").Range... portion to a string, this does not work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vStr = "Sheets(" &amp;amp; CHR(34) &amp;amp; "NA" &amp;amp; CHR(34) &amp;amp;&amp;nbsp; ").Range("&amp;nbsp; &amp;amp; CHR(34) &amp;amp; "E3:M3,E6:M6" &amp;amp; CHR(34) &amp;amp; ")"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveSheet.ChartObjects("Chart 2").Activate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveChart.PlotArea.Select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveChart.SetSourceData vStr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I've tried passing Source:=Sheets(1).Range("a1:a10") directly, this cause a macro parse issue due to the :=&lt;/P&gt;&lt;P&gt;3) Putting the range directly inline&lt;/P&gt;&lt;P&gt;xlApp.ActiveChart.SetSourceData Sheets("NA").Range("E3:M3,E6:M6")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please help and tell me how to use commands like this SetSourceData in the QlikView vbscript macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Oct 2014 19:10:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-10-29T19:10:00Z</dc:date>
    <item>
      <title>Using certain excel functions via macro - setsourcedata</title>
      <link>https://community.qlik.com/t5/QlikView/Using-certain-excel-functions-via-macro-setsourcedata/m-p/726912#M260586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are required at times to write macros in QlikView to create custom excel files.&amp;nbsp; I run into issues where the I cannot get the syntax to work to do certain excel tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example commands that require := values sent as parameters where the parameter is not an excel constant.&lt;/P&gt;&lt;P&gt;A specific example I have is attempting to set the source data on an existing chart in the excel document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The microsoft help shows this as (with PlotBy being optional- I am not passing it in):&lt;/P&gt;&lt;P&gt;Charts(1).SetSourceData Source:=Sheets("NA").Range("a1:a10"), PlotBy:=xlColumns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing this manually in excel and recording the macro provides:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveSheet.ChartObjects("Chart 2").Activate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveChart.PlotArea.Select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveChart.SetSourceData &lt;STRONG&gt;Source:=Sheets&lt;/STRONG&gt;("NA").Range("E3:M3,E6:M6")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I handle the Source:=Sheets(1).Range("a1:a10") in the QlikView macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I have tried a variety of things to no avail.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;1) assign the sheets("NA").Range... portion to a string, this does not work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vStr = "Sheets(" &amp;amp; CHR(34) &amp;amp; "NA" &amp;amp; CHR(34) &amp;amp;&amp;nbsp; ").Range("&amp;nbsp; &amp;amp; CHR(34) &amp;amp; "E3:M3,E6:M6" &amp;amp; CHR(34) &amp;amp; ")"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveSheet.ChartObjects("Chart 2").Activate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveChart.PlotArea.Select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlApp.ActiveChart.SetSourceData vStr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I've tried passing Source:=Sheets(1).Range("a1:a10") directly, this cause a macro parse issue due to the :=&lt;/P&gt;&lt;P&gt;3) Putting the range directly inline&lt;/P&gt;&lt;P&gt;xlApp.ActiveChart.SetSourceData Sheets("NA").Range("E3:M3,E6:M6")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please help and tell me how to use commands like this SetSourceData in the QlikView vbscript macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 19:10:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-certain-excel-functions-via-macro-setsourcedata/m-p/726912#M260586</guid>
      <dc:creator />
      <dc:date>2014-10-29T19:10:00Z</dc:date>
    </item>
  </channel>
</rss>

