<?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 Excel vba macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938348#M949710</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi QV Community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to Export a table from Qlikview to Excel via vba macro.&lt;/P&gt;&lt;P&gt;I´m using the following macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Excel&lt;BR /&gt;call ExcelExport(objID)&lt;BR /&gt;End sub &lt;BR /&gt; &lt;BR /&gt; FUNCTION ExcelExport(objID)&lt;BR /&gt; set obj = ActiveDocument.GetSheetObject( "TB04" )&lt;BR /&gt; w = obj.GetColumnCount&lt;BR /&gt; if obj.GetRowCount&amp;gt;1001 then&lt;BR /&gt; h=1000 &lt;BR /&gt; else h=obj.GetRowCount&lt;BR /&gt; end if&lt;BR /&gt; Set objExcel = CreateObject("Excel.Application")&amp;nbsp; &lt;BR /&gt; set XLDOC = objExcel.Workbooks.open ("C:\Users\Admin\Desktop\Metrics_Macro_export.xlsx")&lt;BR /&gt; objExcel.Visible = True&lt;BR /&gt; set CellMatrix = obj.GetCells2(0,0,w,h)&lt;BR /&gt; column = 1&lt;BR /&gt; for cc=0 to w-1&lt;BR /&gt; objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text&lt;BR /&gt; objExcel.Cells(1,column).EntireRow.Font.Bold = True&lt;BR /&gt; column = column +1&lt;BR /&gt; next&lt;BR /&gt; c = 1&lt;BR /&gt; r =2&lt;BR /&gt; for RowIter=1 to h-1 &lt;BR /&gt; for ColIter=0 to w-1 &lt;BR /&gt; objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text&lt;BR /&gt; c = c +1&lt;BR /&gt; next&lt;BR /&gt; r = r+1&lt;BR /&gt; c = 1&lt;BR /&gt; next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveWorkbook.SaveAs ("C:\Users\Admin\Desktop\Metrics_Macro_export.xlsx")&lt;/P&gt;&lt;P&gt;End Function &lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;So far so good. The macro opens the excelfile and it pastes the new Information into the excelfile.&lt;/P&gt;&lt;P&gt;But now i need to save this updated file under the same filename and path.&lt;/P&gt;&lt;P&gt;What am i doing wrong? The macro is not saving the updated file.&lt;/P&gt;&lt;P&gt;ActiveWorkbook.SaveAs seems not to be the correct command to save the open Excelfile!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx for helping&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Dec 2015 09:05:00 GMT</pubDate>
    <dc:creator>Frank_Hartmann</dc:creator>
    <dc:date>2015-12-16T09:05:00Z</dc:date>
    <item>
      <title>Excel vba macro</title>
      <link>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938348#M949710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi QV Community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to Export a table from Qlikview to Excel via vba macro.&lt;/P&gt;&lt;P&gt;I´m using the following macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Excel&lt;BR /&gt;call ExcelExport(objID)&lt;BR /&gt;End sub &lt;BR /&gt; &lt;BR /&gt; FUNCTION ExcelExport(objID)&lt;BR /&gt; set obj = ActiveDocument.GetSheetObject( "TB04" )&lt;BR /&gt; w = obj.GetColumnCount&lt;BR /&gt; if obj.GetRowCount&amp;gt;1001 then&lt;BR /&gt; h=1000 &lt;BR /&gt; else h=obj.GetRowCount&lt;BR /&gt; end if&lt;BR /&gt; Set objExcel = CreateObject("Excel.Application")&amp;nbsp; &lt;BR /&gt; set XLDOC = objExcel.Workbooks.open ("C:\Users\Admin\Desktop\Metrics_Macro_export.xlsx")&lt;BR /&gt; objExcel.Visible = True&lt;BR /&gt; set CellMatrix = obj.GetCells2(0,0,w,h)&lt;BR /&gt; column = 1&lt;BR /&gt; for cc=0 to w-1&lt;BR /&gt; objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text&lt;BR /&gt; objExcel.Cells(1,column).EntireRow.Font.Bold = True&lt;BR /&gt; column = column +1&lt;BR /&gt; next&lt;BR /&gt; c = 1&lt;BR /&gt; r =2&lt;BR /&gt; for RowIter=1 to h-1 &lt;BR /&gt; for ColIter=0 to w-1 &lt;BR /&gt; objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text&lt;BR /&gt; c = c +1&lt;BR /&gt; next&lt;BR /&gt; r = r+1&lt;BR /&gt; c = 1&lt;BR /&gt; next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveWorkbook.SaveAs ("C:\Users\Admin\Desktop\Metrics_Macro_export.xlsx")&lt;/P&gt;&lt;P&gt;End Function &lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;So far so good. The macro opens the excelfile and it pastes the new Information into the excelfile.&lt;/P&gt;&lt;P&gt;But now i need to save this updated file under the same filename and path.&lt;/P&gt;&lt;P&gt;What am i doing wrong? The macro is not saving the updated file.&lt;/P&gt;&lt;P&gt;ActiveWorkbook.SaveAs seems not to be the correct command to save the open Excelfile!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx for helping&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2015 09:05:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938348#M949710</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2015-12-16T09:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excel vba macro</title>
      <link>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938349#M949711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it only with save: XLDOC.save&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2015 09:08:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938349#M949711</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-12-16T09:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Excel vba macro</title>
      <link>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938350#M949712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;Hi Frank,&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;Try,&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;Sub Excel&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;call ExcelExport(objID)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;End sub&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FUNCTION ExcelExport(objID)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;set obj = ActiveDocument.GetSheetObject( "TB04" )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;w = obj.GetColumnCount&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;if obj.GetRowCount&amp;gt;1001 then&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;h=1000 &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;else h=obj.GetRowCount&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;end if&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Set objExcel = CreateObject("Excel.Application")&amp;nbsp; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;set XLDOC = objExcel.Workbooks.open ("C:\Users\Admin\Desktop\Metrics_Macro_export.xlsx")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;objExcel.Visible = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;set CellMatrix = obj.GetCells2(0,0,w,h)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;column = 1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for cc=0 to w-1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;objExcel.Cells(1,column).EntireRow.Font.Bold = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;column = column +1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;next&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;c = 1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;r =2&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for RowIter=1 to h-1 &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for ColIter=0 to w-1 &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;c = c +1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;next&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;r = r+1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;c = 1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;next&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="color: #ff0000;"&gt;&lt;STRONG&gt;ActiveWorkbook.Save&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style=": ; color: #ff0000;"&gt;&lt;STRONG&gt;ActiveWorkbook.Close&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;End Function&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2015 09:10:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938350#M949712</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2015-12-16T09:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Excel vba macro</title>
      <link>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938351#M949713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you very much &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2015 09:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Excel-vba-macro/m-p/938351#M949713</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2015-12-16T09:11:10Z</dc:date>
    </item>
  </channel>
</rss>

