<?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 Editing a macro... VB help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Editing-a-macro-VB-help/m-p/816595#M288014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're currently using Stefan's method for exporting some tables out to excel&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/" title="http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/"&gt;QlikTip #32: Exporting multiple QV objects to a single Excel document&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, I'm trying to pass some Excel ActiveWindow VBA properties, but can't seem to get it right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're not familiar, his code asks for you to fill an array with information and then call a function called &lt;SPAN style="font-size: 13.3333330154419px;"&gt;copyObjectsToExcelSheet()&lt;/SPAN&gt;. The function looks like this:&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241172450166742" jivemacro_uid="_14241172450166742"&gt;
&lt;P&gt;Set objExcelApp = CreateObject("Excel.Application")&lt;/P&gt;
&lt;P&gt;Set objExcelDoc = objExcelApp.Workbooks.Add&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'a bunch of stuff with the array&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Set copyObjectsToExcelSheet = objExcelDoc&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;end function&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;After the function ends, you're sent back to the original sub, which ends this way:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241168793428456" jivemacro_uid="_14241168793428456"&gt;
&lt;P&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;/P&gt;
&lt;P&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;/P&gt;
&lt;P&gt;'// Now either just leave Excel open or do some other stuff here&lt;/P&gt;
&lt;P&gt;'// like saving the excel, some formatting stuff, ...&amp;nbsp; &lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, the author encourages you to make any changes at this point, by adding to the code.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;After the code runs,&lt;STRONG&gt; I can&lt;/STRONG&gt; make changes to the Sheet objects by adding some things. Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_1424117362139844 jive_macro_code" jivemacro_uid="_1424117362139844"&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;For i = 1 to 4&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; With objExcelWorkbook.Sheets(i).Range("A1:A2").Font&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "Calibri"&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Size = 20&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; .Bold = True&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; objExcelWorkbook.Sheets(i).Range("8:8").WrapText &lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;= Tru&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;e&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;next&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;But&lt;STRONG&gt; I can't&lt;/STRONG&gt; edit some ActiveWindow properties in excel. Like these:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241175524681750" jivemacro_uid="_14241175524681750"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveWindow.FreezePanes = True&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveWindow.DisplayGridlines = False&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I pass ActiveWindow properties to the sheets that the function worked on? Can I do this without editing the function any further?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Feb 2015 20:16:29 GMT</pubDate>
    <dc:creator>deec</dc:creator>
    <dc:date>2015-02-16T20:16:29Z</dc:date>
    <item>
      <title>Editing a macro... VB help</title>
      <link>https://community.qlik.com/t5/QlikView/Editing-a-macro-VB-help/m-p/816595#M288014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're currently using Stefan's method for exporting some tables out to excel&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/" title="http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/"&gt;QlikTip #32: Exporting multiple QV objects to a single Excel document&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, I'm trying to pass some Excel ActiveWindow VBA properties, but can't seem to get it right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're not familiar, his code asks for you to fill an array with information and then call a function called &lt;SPAN style="font-size: 13.3333330154419px;"&gt;copyObjectsToExcelSheet()&lt;/SPAN&gt;. The function looks like this:&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241172450166742" jivemacro_uid="_14241172450166742"&gt;
&lt;P&gt;Set objExcelApp = CreateObject("Excel.Application")&lt;/P&gt;
&lt;P&gt;Set objExcelDoc = objExcelApp.Workbooks.Add&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'a bunch of stuff with the array&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Set copyObjectsToExcelSheet = objExcelDoc&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;end function&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;After the function ends, you're sent back to the original sub, which ends this way:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241168793428456" jivemacro_uid="_14241168793428456"&gt;
&lt;P&gt;Dim objExcelWorkbook 'as Excel.Workbook&lt;/P&gt;
&lt;P&gt;Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)&lt;/P&gt;
&lt;P&gt;'// Now either just leave Excel open or do some other stuff here&lt;/P&gt;
&lt;P&gt;'// like saving the excel, some formatting stuff, ...&amp;nbsp; &lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, the author encourages you to make any changes at this point, by adding to the code.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;After the code runs,&lt;STRONG&gt; I can&lt;/STRONG&gt; make changes to the Sheet objects by adding some things. Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_1424117362139844 jive_macro_code" jivemacro_uid="_1424117362139844"&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;For i = 1 to 4&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; With objExcelWorkbook.Sheets(i).Range("A1:A2").Font&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "Calibri"&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Size = 20&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; .Bold = True&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; objExcelWorkbook.Sheets(i).Range("8:8").WrapText &lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;= Tru&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;e&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 12pt;"&gt;next&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;But&lt;STRONG&gt; I can't&lt;/STRONG&gt; edit some ActiveWindow properties in excel. Like these:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14241175524681750" jivemacro_uid="_14241175524681750"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveWindow.FreezePanes = True&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveWindow.DisplayGridlines = False&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I pass ActiveWindow properties to the sheets that the function worked on? Can I do this without editing the function any further?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Feb 2015 20:16:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Editing-a-macro-VB-help/m-p/816595#M288014</guid>
      <dc:creator>deec</dc:creator>
      <dc:date>2015-02-16T20:16:29Z</dc:date>
    </item>
  </channel>
</rss>

