<?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 table to Excel with Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766751#M272403</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to export data from a table into Excel using a button via a macro. It seems pretty straight forward, but for some reason I can't get it to work. The below code fails on the first line - the Excel object is never created. My button is indeed calling the method - I verified this by putting message boxes before and after the 'Set objXL' line. The first message box fires, but the second one doesn't and the code editor pops up, indicatng and error. Can anyone see anythng wrong with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Excel_Dump()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set objXL = CreateObject("Excel.Application")&lt;BR /&gt;Set objWkb = objXL.Workbooks.Add&lt;BR /&gt;Set objSht1 = objWkb.Worksheets("Sheet1")&lt;BR /&gt;objSht1.Select&lt;BR /&gt;ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true &lt;BR /&gt;objSht1.Paste&lt;BR /&gt;objSht1.Name = "Export"&lt;BR /&gt;XLApp.Visible = true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2015 13:56:43 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-03-09T13:56:43Z</dc:date>
    <item>
      <title>Export table to Excel with Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766751#M272403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to export data from a table into Excel using a button via a macro. It seems pretty straight forward, but for some reason I can't get it to work. The below code fails on the first line - the Excel object is never created. My button is indeed calling the method - I verified this by putting message boxes before and after the 'Set objXL' line. The first message box fires, but the second one doesn't and the code editor pops up, indicatng and error. Can anyone see anythng wrong with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Excel_Dump()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set objXL = CreateObject("Excel.Application")&lt;BR /&gt;Set objWkb = objXL.Workbooks.Add&lt;BR /&gt;Set objSht1 = objWkb.Worksheets("Sheet1")&lt;BR /&gt;objSht1.Select&lt;BR /&gt;ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true &lt;BR /&gt;objSht1.Paste&lt;BR /&gt;objSht1.Name = "Export"&lt;BR /&gt;XLApp.Visible = true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 13:56:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766751#M272403</guid>
      <dc:creator />
      <dc:date>2015-03-09T13:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Export table to Excel with Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766752#M272404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figued it out. I had to adjust the Requsted Modue Security and Current Local Security to System Access. I wound up using the following code, if anyone in the future would like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Excel_Dump()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set objXL = CreateObject("Excel.Application")&lt;BR /&gt;set objWkb = objXL.Workbooks.Add&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objXL.Visible = False&lt;BR /&gt;objWkb.Worksheets("Sheet1").Range("A1").Select()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objWkb.Worksheets("Sheet1").PasteSpecial&lt;BR /&gt;objWkb.Worksheets("Sheet1").Name= "Export"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objXL.Visible = False&lt;BR /&gt;end Sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 14:44:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766752#M272404</guid>
      <dc:creator />
      <dc:date>2015-03-09T14:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Export table to Excel with Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766753#M272405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please tell me how to save Excel to a folder,&lt;/P&gt;&lt;P&gt;When I add these code :&lt;STRONG&gt; XLDoc.SaveAs Path,true&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;it will open the macro editer windows again and always ask me whether replace the existing file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub ExcelFile&lt;/P&gt;&lt;P&gt;&amp;nbsp; strDate = CDate(Date)&lt;/P&gt;&lt;P&gt;&amp;nbsp; strDay = DatePart("d", strDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp; strMonth = DatePart("m", strDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp; strYear = DatePart("yyyy", strDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp; If strDay &amp;lt; 10 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strDay = "0" &amp;amp; strDay&lt;/P&gt;&lt;P&gt;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp; If strMonth &amp;lt; 10 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strMonth = "0" &amp;amp; strMonth&lt;/P&gt;&lt;P&gt;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp; GetFormattedDate = strMonth &amp;amp; "-" &amp;amp; strDay &amp;amp; "-" &amp;amp; strYear&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt; Path = "C:\Users\Administrator\Desktop\培训\Distribute\Book5.xls"&lt;/P&gt;&lt;P&gt; FileName = "Test_" &amp;amp; GetFormattedDate&amp;nbsp; &amp;amp; ".xlsx"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; set XLApp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' XLApp.Visible = true&lt;/P&gt;&lt;P&gt; set XLDoc = XLApp.Workbooks.Add&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ActiveDocument.GetSheetObject("CH23").CopyTableToClipboard true&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(1).Paste()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(1).Rows("1:3000").EntireRow.AutoFit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ActiveDocument.GetSheetObject("CH17").CopyTableToClipboard true&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(2).Paste()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(2).Rows("1:3000").EntireRow.AutoFit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(1).Name = "Page One"&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(2).Name = "Page Two"&lt;/P&gt;&lt;P&gt; XLDoc.Sheets(3).Delete&lt;/P&gt;&lt;P&gt;' XLDoc.Sheets(1).Range("A1").Select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; XLDoc.SaveAs Path,true&lt;/P&gt;&lt;P&gt;' XLDoc.ExportBiff "C:\Users\Administrator\Desktop\培训\Distribute\Book5.xlsx"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 May 2015 09:31:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Export-table-to-Excel-with-Macro/m-p/766753#M272405</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-24T09:31:58Z</dc:date>
    </item>
  </channel>
</rss>

