<?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 Re: variable in macro to set path in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483392#M180628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;When I try this code, it gives me the error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;”.xlsx"&amp;nbsp; is unknown string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;sub Export&lt;BR /&gt;&lt;BR /&gt;Dim aryExport(0,3)&lt;BR /&gt;&lt;BR /&gt;aryExport(0,0) = "CH01"&amp;nbsp;&amp;nbsp; &lt;BR /&gt;aryExport(0,1) = "Amount per country" &lt;BR /&gt;aryExport(0,2) = "A3"&lt;BR /&gt;aryExport(0,3) = "data"&lt;BR /&gt;&lt;BR /&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;BR /&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;vVar = ActiveDocument.Variables("vVar").GetContent.String&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filePath = "C:\test\test "&amp;amp;vVar&amp;amp;”.xlsx" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: arial, helvetica, sans-serif; color: black;"&gt;objExcelWorkbook.SaveAs filePath&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jul 2013 07:11:20 GMT</pubDate>
    <dc:creator>omyahamburg</dc:creator>
    <dc:date>2013-07-16T07:11:20Z</dc:date>
    <item>
      <title>variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483390#M180626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Hi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a real newbie in macros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I have a variable in my qvw named vVar with the value "2013-06".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I like to use this variable in my export to excel macro to set the file name under which the excel file will be stored.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;After extensive searching I am still struggling and don't get it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;This is my macro code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'///////////////////////////&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;sub Export&lt;BR /&gt;&lt;BR /&gt;Dim aryExport(0,3)&lt;BR /&gt;&lt;BR /&gt;aryExport(0,0) = "CH01"&amp;nbsp;&amp;nbsp; &lt;BR /&gt;aryExport(0,1) = "Amount per country" &lt;BR /&gt;aryExport(0,2) = "A3"&lt;BR /&gt;aryExport(0,3) = "data"&lt;BR /&gt;&lt;BR /&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;BR /&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;BR /&gt;&lt;BR /&gt;'filePath = "C:\test\test "&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: red;"&gt;&amp;amp;vVar&amp;amp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;”.xlsx"&amp;nbsp; '// this is not working&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;filePath = "C:\test\test 2013-06&lt;SPAN lang="EN-US" style="color: black;"&gt;.xlsx"&amp;nbsp; '// manually setting the file name is working&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;objExcelWorkbook.SaveAs filePath&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;'///////////////////////////&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;Additionally I would like to put the caption into cell "A1" in the excel workbook.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;Can somebody help me out ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;rgds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;Joerg&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: arial,helvetica,sans-serif; color: black; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 06:53:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483390#M180626</guid>
      <dc:creator>omyahamburg</dc:creator>
      <dc:date>2013-07-16T06:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483391#M180627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to get that value of the variable first and assign it to vVar:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vVar =&amp;nbsp; ActiveDocument.Variables("vVar").GetContent.String&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 07:04:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483391#M180627</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-07-16T07:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483392#M180628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;When I try this code, it gives me the error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;”.xlsx"&amp;nbsp; is unknown string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;sub Export&lt;BR /&gt;&lt;BR /&gt;Dim aryExport(0,3)&lt;BR /&gt;&lt;BR /&gt;aryExport(0,0) = "CH01"&amp;nbsp;&amp;nbsp; &lt;BR /&gt;aryExport(0,1) = "Amount per country" &lt;BR /&gt;aryExport(0,2) = "A3"&lt;BR /&gt;aryExport(0,3) = "data"&lt;BR /&gt;&lt;BR /&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;BR /&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;vVar = ActiveDocument.Variables("vVar").GetContent.String&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filePath = "C:\test\test "&amp;amp;vVar&amp;amp;”.xlsx" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: arial, helvetica, sans-serif; color: black;"&gt;objExcelWorkbook.SaveAs filePath&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 07:11:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483392#M180628</guid>
      <dc:creator>omyahamburg</dc:creator>
      <dc:date>2013-07-16T07:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483393#M180629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;set XLApp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLApp.Visible = False&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set XLDoc = XLApp.Workbooks.Add &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;XLDoc.Sheets(1).Cells(1,1).Value='Title'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Save as the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kabilan K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 07:18:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483393#M180629</guid>
      <dc:creator />
      <dc:date>2013-07-16T07:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483394#M180630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You've got a wrong quote in there: filePath = "C:\test\test "&amp;amp;vVar&amp;amp;&lt;SPAN style="color: #ff0000; background-color: #ffffff; font-family: Arial;"&gt;&lt;STRONG&gt;”&lt;/STRONG&gt;&lt;/SPAN&gt;.xlsx". Make sure you use the double quotes character. Also, if that's not the problem try using msgbox statements to see what vVar and filepath contain:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox vVar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox filepath&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 09:13:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483394#M180630</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-07-16T09:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: variable in macro to set path</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483395#M180631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I got it working (unfortunately still without export of the caption):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub exportToExcel_Variant1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim aryExport(0,3)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;aryExport(0,0) = "CH02" &lt;BR /&gt;aryExport(0,1) = "Amount by country" &lt;BR /&gt;aryExport(0,2) = "A3"&lt;BR /&gt;aryExport(0,3) = "data"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;BR /&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set v = ActiveDocument.Variables("vVar")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;filePath = "C:\test "&amp;amp;(v.GetContent.String)&amp;amp;".xlsx"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;objExcelWorkbook.SaveAs filePath&lt;BR /&gt;'objExcelWorkbook.Close &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end sub &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 09:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-macro-to-set-path/m-p/483395#M180631</guid>
      <dc:creator>omyahamburg</dc:creator>
      <dc:date>2013-07-16T09:20:33Z</dc:date>
    </item>
  </channel>
</rss>

