<?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 Export to Excel with macro - failed with selections in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Export-to-Excel-with-macro-failed-with-selections/m-p/241642#M502194</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The application has a button that generates excel reports.&lt;/P&gt;&lt;P&gt;When nothing selected, it worked fine.&lt;/P&gt;&lt;P&gt;But once selection is made, it shows "Macro parse failed.."&lt;/P&gt;&lt;P&gt;I don't understand for the same code, why does "with or without selections" give different results?&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Sub ExportToXL&lt;BR /&gt;' Set Excel App&lt;BR /&gt; set XLApp = CreateObject("Excel.Application") ' Define Object&lt;BR /&gt; XLApp.Visible = True 'Visible set as true&lt;BR /&gt; set XLDoc = XLApp.Workbooks.Add 'Open new workbook&lt;BR /&gt; ' Get TB2&lt;BR /&gt; set table = ActiveDocument.GetSheetObject("CH162")&lt;BR /&gt; ' Copy table and paste into Excel&lt;BR /&gt; set XLSheet = XLDoc.Worksheets(1)&lt;BR /&gt; table.CopyTableToClipboard true&lt;BR /&gt; XLSheet.Paste XLSheet.Range("A1")&lt;BR /&gt; Set xlRange1 = XLSheet.Columns("C:C")&lt;BR /&gt; xlRange1.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange2 = XLSheet.Columns("D:D")&lt;BR /&gt; xlRange2.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange3 = XLSheet.Columns("E:E")&lt;BR /&gt; xlRange3.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange4 = XLSheet.Columns("F:F")&lt;BR /&gt; xlRange4.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange5 = XLSheet.Columns("H:H")&lt;BR /&gt; xlRange5.NumberFormat = "#,##0"&lt;BR /&gt; XLSheet.Cells.EntireRow.RowHeight = 15&lt;BR /&gt; XLSheet.Range("A1:A60000").ColumnWidth = 16&lt;BR /&gt; XLSheet.Range("B1:B60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("C1:C60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("D1:D60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("E1:E60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("F1:F60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("G1:G60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("H1:H60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("I1:I60000").ColumnWidth = 15&lt;BR /&gt; XLsheet.PageSetup.Orientation = 2 'Landscape&lt;BR /&gt; XLsheet.PageSetup.LeftMargin = xlApp.CentimetersToPoints(1)&lt;BR /&gt; XLsheet.PageSetup.RightMargin = xlApp.CentimetersToPoints(1)&lt;BR /&gt; XLsheet.PageSetup.HeaderMargin = xlApp.CentimetersToPoints(0.5)&lt;BR /&gt; XLsheet.PageSetup.TopMargin = xlApp.CentimetersToPoints(1.3)&lt;BR /&gt; XLsheet.PageSetup.BottomMargin = xlApp.CentimetersToPoints(1.3)&lt;BR /&gt; XLsheet.PageSetup.FooterMargin = xlApp.CentimetersToPoints(0.5)&lt;BR /&gt; XLSheet.PageSetup.Zoom = False&lt;BR /&gt; XLSheet.PageSetup.FitToPagesWide = 1&lt;BR /&gt; XLSheet.PageSetup.FitToPagesTall = 100&lt;BR /&gt; XLSheet.PageSetup.PrintTitleRows = xlSheet.Rows(1).Address&lt;BR /&gt; XLSheet.PageSetup.PrintGridlines = True&lt;BR /&gt; XLSheet.name = "Region"&lt;BR /&gt;&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Aug 2010 19:35:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-08-04T19:35:53Z</dc:date>
    <item>
      <title>Export to Excel with macro - failed with selections</title>
      <link>https://community.qlik.com/t5/QlikView/Export-to-Excel-with-macro-failed-with-selections/m-p/241642#M502194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The application has a button that generates excel reports.&lt;/P&gt;&lt;P&gt;When nothing selected, it worked fine.&lt;/P&gt;&lt;P&gt;But once selection is made, it shows "Macro parse failed.."&lt;/P&gt;&lt;P&gt;I don't understand for the same code, why does "with or without selections" give different results?&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Sub ExportToXL&lt;BR /&gt;' Set Excel App&lt;BR /&gt; set XLApp = CreateObject("Excel.Application") ' Define Object&lt;BR /&gt; XLApp.Visible = True 'Visible set as true&lt;BR /&gt; set XLDoc = XLApp.Workbooks.Add 'Open new workbook&lt;BR /&gt; ' Get TB2&lt;BR /&gt; set table = ActiveDocument.GetSheetObject("CH162")&lt;BR /&gt; ' Copy table and paste into Excel&lt;BR /&gt; set XLSheet = XLDoc.Worksheets(1)&lt;BR /&gt; table.CopyTableToClipboard true&lt;BR /&gt; XLSheet.Paste XLSheet.Range("A1")&lt;BR /&gt; Set xlRange1 = XLSheet.Columns("C:C")&lt;BR /&gt; xlRange1.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange2 = XLSheet.Columns("D:D")&lt;BR /&gt; xlRange2.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange3 = XLSheet.Columns("E:E")&lt;BR /&gt; xlRange3.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange4 = XLSheet.Columns("F:F")&lt;BR /&gt; xlRange4.NumberFormat = "#,##0"&lt;BR /&gt; Set xlRange5 = XLSheet.Columns("H:H")&lt;BR /&gt; xlRange5.NumberFormat = "#,##0"&lt;BR /&gt; XLSheet.Cells.EntireRow.RowHeight = 15&lt;BR /&gt; XLSheet.Range("A1:A60000").ColumnWidth = 16&lt;BR /&gt; XLSheet.Range("B1:B60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("C1:C60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("D1:D60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("E1:E60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("F1:F60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("G1:G60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("H1:H60000").ColumnWidth = 15&lt;BR /&gt; XLSheet.Range("I1:I60000").ColumnWidth = 15&lt;BR /&gt; XLsheet.PageSetup.Orientation = 2 'Landscape&lt;BR /&gt; XLsheet.PageSetup.LeftMargin = xlApp.CentimetersToPoints(1)&lt;BR /&gt; XLsheet.PageSetup.RightMargin = xlApp.CentimetersToPoints(1)&lt;BR /&gt; XLsheet.PageSetup.HeaderMargin = xlApp.CentimetersToPoints(0.5)&lt;BR /&gt; XLsheet.PageSetup.TopMargin = xlApp.CentimetersToPoints(1.3)&lt;BR /&gt; XLsheet.PageSetup.BottomMargin = xlApp.CentimetersToPoints(1.3)&lt;BR /&gt; XLsheet.PageSetup.FooterMargin = xlApp.CentimetersToPoints(0.5)&lt;BR /&gt; XLSheet.PageSetup.Zoom = False&lt;BR /&gt; XLSheet.PageSetup.FitToPagesWide = 1&lt;BR /&gt; XLSheet.PageSetup.FitToPagesTall = 100&lt;BR /&gt; XLSheet.PageSetup.PrintTitleRows = xlSheet.Rows(1).Address&lt;BR /&gt; XLSheet.PageSetup.PrintGridlines = True&lt;BR /&gt; XLSheet.name = "Region"&lt;BR /&gt;&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 19:35:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Export-to-Excel-with-macro-failed-with-selections/m-p/241642#M502194</guid>
      <dc:creator />
      <dc:date>2010-08-04T19:35:53Z</dc:date>
    </item>
  </channel>
</rss>

