<?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 Re: Automation Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869627#M304083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look here: &lt;A href="https://community.qlik.com/docs/DOC-3772"&gt;Automated Excel Export and Email Macro&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 May 2015 10:13:25 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-05-04T10:13:25Z</dc:date>
    <item>
      <title>Automation Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869626#M304082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im having trouble trying to automate a report emailing solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i currently have is a Customer field "CustomerID' and the associated Customer Email Field "CustomerEmail".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a macro that will for loop thru CustomerID and for every possible selection export specific table to excel file, attach it to email and send it off to CustomerEmail adress.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following script is the one i use to export each file to its own:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens is :&lt;/P&gt;&lt;P&gt;Variable EmailChart = my chart ID object that i export&lt;/P&gt;&lt;P&gt;Variable EmailXLSpath = path where all my excel files is dumped&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will loop thru CustomerID, export each object to CustomerID's name as a Excel file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this script is run it must attach each file to its own email (draft if possible) with the "to" adress of CustomerEmail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14307309112967502 jive_text_macro" jivemacro_uid="_14307309112967502" modifiedtitle="true"&gt;
&lt;P&gt;FUNCTION getVariable(varName)&lt;/P&gt;
&lt;P&gt;set v = ActiveDocument.Variables(varName)&lt;/P&gt;
&lt;P&gt;getVariable = v.GetContent.String&lt;/P&gt;
&lt;P&gt;END FUNCTION&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Sub ExportXLS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pathcorp = getVariable("EmailXLSpath")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set corp = ActiveDocument.GetSheetObject(getVariable("EmailChart"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Fields("CustomerID").Clear&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set val=ActiveDocument.Fields("CustomerID").GetPossibleValues&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set XLApp = CreateObject("EXCEL.application")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XLApp.Visible = FALSE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set XLDoc = XLApp.Workbooks.Add&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i=0 to val.Count-1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set MyTable = ActiveDocument.GetSheetObject(getVariable("EmailChart"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = getVariable("EmailXLSpath")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.Fields("CustomerID").Select val.Item(i).Text&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyTable.ExportBiff&amp;nbsp; path &amp;amp; val.Item(i).Text &amp;amp;".xls"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Set XLApp = Nothing&lt;/P&gt;
&lt;P&gt;Set Table = Nothing&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Msgbox "Exported Sucessfully"&lt;/P&gt;
&lt;P&gt;end sub&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 09:19:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869626#M304082</guid>
      <dc:creator />
      <dc:date>2015-05-04T09:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869627#M304083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look here: &lt;A href="https://community.qlik.com/docs/DOC-3772"&gt;Automated Excel Export and Email Macro&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 10:13:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869627#M304083</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-05-04T10:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869628#M304084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus, thanx for the link i have seen that one before and altho it helped me it wont solve my problem as the "to email adress" is fixed, i need one that can "autocomplete" the "to adress" with my CustomerEmail field&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 10:27:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869628#M304084</guid>
      <dc:creator />
      <dc:date>2015-05-04T10:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869629#M304085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In general you could use the same methods like above used within the export-code - reading/selecting fields/listboxes and variables to grab the email.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I like to use a tablebox in such cases then all values in a row are already connected. Here a short snippet from such a logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1430736551234544 jive_text_macro" jivemacro_uid="_1430736551234544" modifiedtitle="true"&gt;
&lt;P&gt;Set Table_One = ActiveDocument.GetSheetObject("TB12") 'Variable initialisieren --&amp;gt; Listbox der Gebiete&lt;/P&gt;
&lt;P&gt;Column_One = Table_One.GetColumnCount 'Variable Wert zuweisen --&amp;gt; Anzahl Spalten der Listbox auslesen&lt;/P&gt;
&lt;P&gt;Row_One = Table_One.GetRowCount ''Variable Wert zuweisen --&amp;gt; Anzahl Zeilen der Listbox auslesen&lt;/P&gt;
&lt;P&gt;Set ZellMatrix_One = Table_One.GetCells2(0,0,Column_One,Row_One) ' Variable initialisieren --&amp;gt; Zellschnittpunkt zuweisen&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'erneutes Auslesen der tabellenbox "Versand-Matrix"&lt;/P&gt;
&lt;P&gt;For i_Row = 1 to Row_One - 1 '0 to Row_One - 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i_Col = 4 to 4 '0 to Column_One - 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Zeit_2 = Now()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; send_vk = (ZellMatrix_One(i_Row)(i_Col -4).Text) 'Variable Wert zuweisen --&amp;gt; ausgelesenes Vertriebskanal&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; send_be_One = (ZellMatrix_One(i_Row)(i_Col -3).Text) 'Variable Wert zuweisen --&amp;gt; Struktur-Bereich (Variante 1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; send_be_Two = (ZellMatrix_One(i_Row)(i_Col - 2).Text) 'Variable Wert zuweisen --&amp;gt; Struktur-Bereich (Variante 2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; send_art = (ZellMatrix_One(i_Row)(i_Col - 1).Text) 'Variable Wert zuweisen --&amp;gt; Berichtsart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TB = (ZellMatrix_One(i_Row)(i_Col).Text) 'Variable Wert zuweisen --&amp;gt; Tabellenbox-ID (enthät die Mailadressen)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 10:50:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automation-Macro/m-p/869629#M304085</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-05-04T10:50:14Z</dc:date>
    </item>
  </channel>
</rss>

