<?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 Macro To Excel Not Exporting Field Name in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160828#M34947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I have created a macro to export a table to excel. I can format it, eg underlining, font changes, wrap text etc but one thing I cant seem to figure out is that it does not export the field names, only the field values within the table. Is there something glaringly obvious I am missing here?&lt;/P&gt;&lt;P&gt;Any comments would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Oct 2010 09:48:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-27T09:48:21Z</dc:date>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160828#M34947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I have created a macro to export a table to excel. I can format it, eg underlining, font changes, wrap text etc but one thing I cant seem to figure out is that it does not export the field names, only the field values within the table. Is there something glaringly obvious I am missing here?&lt;/P&gt;&lt;P&gt;Any comments would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 09:48:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160828#M34947</guid>
      <dc:creator />
      <dc:date>2010-10-27T09:48:21Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160829#M34948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;Without seeing the code you are using it's not easy to say what is going awry. However, the attached is a portion of code that is definitely working for 'us':&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Sub Excel_Table_Export&lt;BR /&gt; set s=ActiveDocument.Sheets("Intro")&lt;/P&gt;&lt;P&gt;set XLApp = CreateObject("Excel.Application")&lt;BR /&gt; set XLDOC = XLApp.Workbooks.Open ("P:\XXXXXX.xlsx")&lt;BR /&gt; XLApp.Visible = True&lt;BR /&gt;&lt;BR /&gt; set s=ActiveDocument.Sheets("Excel Exports")&lt;BR /&gt; ActiveDocument.Sheets("Excel Exports").Activate&lt;BR /&gt; ActiveDocument.ClearCache&lt;BR /&gt; ActiveDocument.GetApplication.WaitForIdle&lt;BR /&gt; ActiveDocument.GetSheetObject("CH38").Restore&lt;BR /&gt; ActiveDocument.GetSheetObject("CH38").CopyTableToClipboard true&lt;BR /&gt; set XLSheet = XLDOC.Worksheets("P1(a)")&lt;BR /&gt; XLSheet.Paste XLSheet.Range("A1")&lt;BR /&gt;&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("A1")&lt;BR /&gt; XLActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Insert&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("A2")&lt;BR /&gt; XLActiveCell.FormulaR1C1 = "=TRIM(R[-1]C)"&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("B2")&lt;BR /&gt; XLActiveCell.FormulaR1C1 = "=TRIM(R[-1]C)"&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("C2")&lt;BR /&gt; XLActiveCell.FormulaR1C1 = "=TRIM(R[-1]C)"&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("D2")&lt;BR /&gt; XLActiveCell.FormulaR1C1 = "=TRIM(R[-1]C)"&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("E2")&lt;BR /&gt; XLActiveCell.FormulaR1C1 = "=TRIM(R[-1]C)"&lt;BR /&gt;&lt;BR /&gt; Const XLPasteValues = -4163&lt;BR /&gt; Const xlShiftUp = -4162&lt;BR /&gt;&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("A1")&lt;BR /&gt; Set XLSelection = XLActiveCell.Offset(1, 0).Range("A1:E1")'.Copy&lt;BR /&gt; XLSelection.Copy&lt;BR /&gt; XLSelection.PasteSpecial(XLPasteValues)&lt;BR /&gt; XLApp.CutCopyMode = False&lt;BR /&gt; XLSelection.Copy&lt;BR /&gt; XLSheet.Paste XLSheet.Range("A1")&lt;BR /&gt; Set XLRowDelete = XLActiveCell.Offset(1, 0).Range("A1:E1")&lt;BR /&gt; XLRowDelete.Delete(xlShiftUp)&lt;/P&gt;&lt;P&gt;I do the trimming as [for some reason that I've not yet worked out!] whenever the headers are pasted they have a leading space, which screws up pivots down the line. But, as I stated earlier, this code is definitely working for 'us'. Anyway, good luck!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 10:17:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160829#M34948</guid>
      <dc:creator />
      <dc:date>2010-10-27T10:17:18Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160830#M34949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Go To Setting-&amp;gt; User Preference-&amp;gt; Export-&amp;gt; Copy To Clipboard&lt;/P&gt;&lt;P&gt;Click "Table Box" available in the option "Include caption and Border"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 10:22:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160830#M34949</guid>
      <dc:creator>suniljain</dc:creator>
      <dc:date>2010-10-27T10:22:04Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160831#M34950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the comments,&lt;/P&gt;&lt;P&gt;Sunil, unfortunately the settings change doesn't work in my case even though i am exporting a table box.&lt;/P&gt;&lt;P&gt;My macro is as follows:&lt;/P&gt;&lt;P&gt;sub ExportToXL2&lt;BR /&gt; Const xlShiftUp = -4162&lt;BR /&gt; set XLApp = CreateObject("Excel.Application")&lt;BR /&gt; XLApp.Visible = True&lt;BR /&gt; Application.Sleep(1000)&lt;/P&gt;&lt;P&gt;ActiveDocument.GetSheetObject("TB01").CopyTextToClipboard&lt;BR /&gt; XLApp.Worksheets(1).Paste()&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Bold = True&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Underline = True&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Size = 12&lt;BR /&gt; XLApp.Worksheets(1).Cells.WrapText = True&lt;BR /&gt; XLApp.Worksheets(1).Cells.ColumnWidth = 20&lt;BR /&gt;&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;Can't seem to see why this won't copy field names into first row still. Is it to do with your part of the code: XLActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Insert?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 11:35:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160831#M34950</guid>
      <dc:creator />
      <dc:date>2010-10-27T11:35:02Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160832#M34951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;set obj = ActiveDocument.GetSheetObject("CH239")&lt;BR /&gt;obj.ExportEx "E:\Qlikview\Prima\PPT\Department_Loadinng.xls",5&lt;BR /&gt;set obj = ActiveDocument.GetSheetObject("CH238")&lt;BR /&gt;obj.ExportEx "E:\Qlikview\Prima\PPT\Top_5_Project.xls",5&lt;BR /&gt;set obj = ActiveDocument.GetSheetObject("CH202")&lt;BR /&gt;obj.ExportEx "E:\Qlikview\Prima\PPT\0HrsProject.xls",5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 12:08:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160832#M34951</guid>
      <dc:creator>suniljain</dc:creator>
      <dc:date>2010-10-27T12:08:35Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160833#M34952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;It's nothing to do with that. That was in there as part of my trimming reqmt. I couldn't get your code to work as I got a runtime error! Anyway, I have slightly re-jigged it and included the opening of an already created file [in this case 'Book1.xlsx'] and I've just run it and it works as per:&lt;/P&gt;&lt;P&gt;sub ExportToXL2&lt;BR /&gt; set XLApp = CreateObject("Excel.Application")&lt;BR /&gt; set XLDOC = XLApp.Workbooks.Open ("C:\Book1.xlsx")&lt;BR /&gt; XLApp.Visible = True&lt;BR /&gt; set XLSheet = XLDOC.Worksheets("Sheet1")&lt;BR /&gt; Const XLPasteValues = -4163&lt;BR /&gt; ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true&lt;BR /&gt; Set XLActiveCell = XLSheet.Range("A1:I1")&lt;BR /&gt; XLSheet.Paste XLSheet.Range("A1")&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Bold = True&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Underline = True&lt;BR /&gt; XLApp.Worksheets(1).Range("A1:I1").Font.Size = 12&lt;BR /&gt; XLApp.Worksheets(1).Cells.WrapText = True&lt;BR /&gt; XLApp.Worksheets(1).Cells.ColumnWidth = 20&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 12:13:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160833#M34952</guid>
      <dc:creator />
      <dc:date>2010-10-27T12:13:13Z</dc:date>
    </item>
    <item>
      <title>Macro To Excel Not Exporting Field Name</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160834#M34953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats great, thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 14:16:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-To-Excel-Not-Exporting-Field-Name/m-p/160834#M34953</guid>
      <dc:creator />
      <dc:date>2010-10-27T14:16:01Z</dc:date>
    </item>
  </channel>
</rss>

