<?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: Writing log using a VB macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Writing-log-using-a-VB-macro/m-p/249631#M707459</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jesús,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just change this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;CODE class="jive-code jive-java"&gt;logFile = openOutputFile(LOGFILE_NAME)&lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;CODE class="jive-code jive-java"&gt;Set logFile = openOutputFile(LOGFILE_NAME)&lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jan 2012 13:06:12 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2012-01-04T13:06:12Z</dc:date>
    <item>
      <title>Writing log using a VB macro</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-log-using-a-VB-macro/m-p/249630#M707458</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;I'm trying to use a VB macro inside the QV loading script in order to write an activity log, but I'm not having luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, this is the code included in the macro section:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="java" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Dim objFSO&lt;/P&gt;&lt;P&gt;Dim logFile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function openOutputFile(filename)&lt;/P&gt;&lt;P&gt;Rem *** Create and open an output file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CONST ForWriting = 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set openOutputFile = objFSO.OpenTextFile(filename, ForWriting, True)&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONST LOGFILE_NAME = "D:\tmp\test1.log"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function WriteLog(message)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logFile = openOutputFile(LOGFILE_NAME)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logFile.WriteLine(message)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logFile.Close&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and inside the QV script, (i.e. in Main tab) the WriteLog function is invoked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET x = WriteLog("test");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The file is being created, but it is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please provide some advice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesús&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 12:34:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-log-using-a-VB-macro/m-p/249630#M707458</guid>
      <dc:creator />
      <dc:date>2012-01-04T12:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Writing log using a VB macro</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-log-using-a-VB-macro/m-p/249631#M707459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jesús,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just change this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;CODE class="jive-code jive-java"&gt;logFile = openOutputFile(LOGFILE_NAME)&lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;CODE class="jive-code jive-java"&gt;Set logFile = openOutputFile(LOGFILE_NAME)&lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 13:06:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-log-using-a-VB-macro/m-p/249631#M707459</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-01-04T13:06:12Z</dc:date>
    </item>
  </channel>
</rss>

