<?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: Error in Macro Export to Excel in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40702#M6876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello VJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your response,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried to change array into &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;for i=0 to UBound(aSheetObj)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;-1 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but still have same error (out of range).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm newbie in macro programming, can you give a sample from better way using FOR EACH?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Apr 2018 08:36:00 GMT</pubDate>
    <dc:creator>hamdaniahmad</dc:creator>
    <dc:date>2018-04-17T08:36:00Z</dc:date>
    <item>
      <title>Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40699#M6873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One question, does anybody know about this error? This error appear after I export in web browser and excel application open.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Picture1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/199723_Picture1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use this macro to export to excel :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub ExportExcel&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;' File Path &amp;amp; Name&lt;/P&gt;&lt;P&gt; Path = "C:\"&lt;/P&gt;&lt;P&gt; FileName = "DailyReport_"&lt;/P&gt;&lt;P&gt; strSaveFile = Path &amp;amp; FileName&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;'Open Excel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set oXL=CreateObject("Excel.Application") &lt;/P&gt;&lt;P&gt;oXL.visible=True &lt;/P&gt;&lt;P&gt;oXL.Workbooks.Add&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aSheetObj=Array("CH334","CH335","CH339","CH337","CH340","CH341","CH342","CH343")&amp;nbsp; ' Chart ID's here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;for i=0 to UBound(aSheetObj)&lt;/P&gt;&lt;P&gt; Set oSH = oXL.ActiveSheet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; num_rows = oSH.UsedRange.Rows.Count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If num_rows = 1&amp;nbsp; then&lt;/P&gt;&lt;P&gt; oSH.Range("A2").Select&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt; Else&lt;/P&gt;&lt;P&gt; oSH.Range("A" &amp;amp; num_rows+4).Select &lt;/P&gt;&lt;P&gt; End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))&lt;/P&gt;&lt;P&gt; obj.CopyTableToClipboard True&lt;/P&gt;&lt;P&gt; oSH.Paste &lt;/P&gt;&lt;P&gt; sCaption=obj.GetCaption.Name.v&lt;/P&gt;&lt;P&gt; set obj=Nothing&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;oSH.Cells.Select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oSH.Columns("A").ColumnWidth = 12.17&lt;/P&gt;&lt;P&gt;oSH.Columns("B").ColumnWidth = 12.17&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If num_rows = 1&amp;nbsp; then&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows).Value = sCaption&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows).Font.Bold = True&lt;/P&gt;&lt;P&gt;'oSH.Range("A" &amp;amp; num_rows).Font.ColorIndex = 3&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows).Interior.ColorIndex = 40&lt;/P&gt;&lt;P&gt; Else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows+3).Value&amp;nbsp; = sCaption&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.Bold = True&lt;/P&gt;&lt;P&gt;'oSH.Range("A" &amp;amp; num_rows+3).Font.ColorIndex = 3&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp;num_rows+3).Interior.ColorIndex = 40&lt;/P&gt;&lt;P&gt; End If&lt;/P&gt;&lt;P&gt; 'oXL.Selection.Columns.AutoFit&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;&amp;nbsp; oSH.Range("A1").Select&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; oXL.Sheets("Sheet2").Delete&lt;/P&gt;&lt;P&gt;&amp;nbsp; oXL.Sheets("Sheet3").Delete&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oSH.Name = "Data"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; oXL.ActiveWorkBook.SaveAs strSaveFile &amp;amp; replace(date, "/", "-") &amp;amp; ".xlsx" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set oSH = Nothing&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set oXL=Nothing&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 09:55:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40699#M6873</guid>
      <dc:creator>hamdaniahmad</dc:creator>
      <dc:date>2018-04-16T09:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40700#M6874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If either of these sheets does not exist you will get the error message you got:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; oXL.Sheets("Sheet2").Delete&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; oXL.Sheets("Sheet3").Delete&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;The other subscripts shouldn't go out of bounds as far as I can tell....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 10:16:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40700#M6874</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-04-16T10:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40701#M6875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ahmad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer is much simplier than you'd think.All arrays have a 0th member. Ubound returns the position of the last item, not the count!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution:&lt;/STRONG&gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;for i=0 to UBound(aSheetObj)&lt;STRONG&gt;-1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; text-decoration: underline;"&gt;Try this test:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sub Test()&lt;/P&gt;&lt;P&gt;&amp;nbsp; y = Array("a", "b", "c")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MsgBox UBound(y)&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bottom line: &lt;/STRONG&gt;Your script does run out of the range. You are looping the sheets and the last one doesn't exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A better way: Forget a fixed list. Loop all sheets through the FOR EACH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, VJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 10:24:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40701#M6875</guid>
      <dc:creator>vsmejkal</dc:creator>
      <dc:date>2018-04-16T10:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40702#M6876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello VJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your response,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried to change array into &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;for i=0 to UBound(aSheetObj)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;-1 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but still have same error (out of range).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm newbie in macro programming, can you give a sample from better way using FOR EACH?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 08:36:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40702#M6876</guid>
      <dc:creator>hamdaniahmad</dc:creator>
      <dc:date>2018-04-17T08:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40703#M6877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ubound() returns the index of the Upper Bound ... not the number of elements in the Array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And arrays start at 0 in VBScript. So his code is correct. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look here: &lt;A href="https://www.w3schools.com/asp/func_ubound.asp" title="https://www.w3schools.com/asp/func_ubound.asp"&gt;VBScript UBound Function&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 08:51:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40703#M6877</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-04-17T08:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40704#M6878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am pretty confident that what I suggested first is a good diagnosis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can test it by just adding a &lt;STRONG&gt;single quotation&lt;/STRONG&gt; mark in front of the two lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt; ' oXL.Sheets("Sheet2").Delete&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt; ' oXL.Sheets("Sheet3").Delete&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;This will comment out the lines and you can verify if the error disappears....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 08:54:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40704#M6878</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-04-17T08:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Macro Export to Excel</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40705#M6879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already add a single quotation to these 2 lines to make it comment and skipped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The excel export is successful, but in IE appear new error, please see picture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Picture1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/199844_Picture1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 09:17:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Macro-Export-to-Excel/m-p/40705#M6879</guid>
      <dc:creator>hamdaniahmad</dc:creator>
      <dc:date>2018-04-17T09:17:54Z</dc:date>
    </item>
  </channel>
</rss>

