<?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: write variable to file using macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595343#M220502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you Michele this works great.&lt;/P&gt;&lt;P&gt;So what I do is create the file with a static filename in c:\temp and have a second action launch this filename.&lt;/P&gt;&lt;P&gt;Is that the right way to go or can/should I launch the file from within the macro?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2014 11:56:29 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-05-06T11:56:29Z</dc:date>
    <item>
      <title>write variable to file using macro</title>
      <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595340#M220499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I need a macro to do the following job:&lt;/P&gt;&lt;P&gt;create a "text file" with the content of a variable and open the file once the button has been clicked. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable contains static text plus two other variables.&lt;/P&gt;&lt;P&gt;I'm already struggling with outputting the actual values the variable holds inside a macro message box.&lt;/P&gt;&lt;P&gt;Example: &lt;/P&gt;&lt;P&gt;vtest = 1+1&lt;/P&gt;&lt;P&gt;Sub CheckVariable &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set vCheck = ActiveDocument.Variables("vTest")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(vCheck.GetContent.String) &lt;/P&gt;&lt;P&gt;End Sub&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This outputs &lt;STRONG&gt;1+1&lt;/STRONG&gt; but how can I get it to output the result of &lt;STRONG&gt;2&lt;/STRONG&gt; (like with the dollar sign expansion)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once this is solved how can write the content of the variable to a &lt;STRONG&gt;.customExtension&lt;/STRONG&gt; file and execute the file to trigger the default program? Could this be some temporary file that is only used in memory or do I have to write it to a path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Thorsten&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 08:34:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595340#M220499</guid>
      <dc:creator />
      <dc:date>2014-05-05T08:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: write variable to file using macro</title>
      <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595341#M220500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; you could try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub CheckVariable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vCheck = ActiveDocument.Evaluate("=$(vtest)")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox vCheck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 09:24:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595341#M220500</guid>
      <dc:creator>bbi_mba_76</dc:creator>
      <dc:date>2014-05-05T09:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: write variable to file using macro</title>
      <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595342#M220501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This to create a file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub writeFile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIM fso, MyFile, strFile, strText&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strFile="D:\YourFile.csv"&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If fso.FileExists(strFile) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MyFile = fso.OpenTextFile (strFile, 8, True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MyFile = fso.CreateTextFile(strFile)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFile.WriteLine("""Date""")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strText= """" &amp;amp; Now() &amp;amp; ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFile.WriteLine(strText)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFile.Close&lt;/P&gt;&lt;P&gt;End Sub&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 09:27:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595342#M220501</guid>
      <dc:creator>bbi_mba_76</dc:creator>
      <dc:date>2014-05-05T09:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: write variable to file using macro</title>
      <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595343#M220502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you Michele this works great.&lt;/P&gt;&lt;P&gt;So what I do is create the file with a static filename in c:\temp and have a second action launch this filename.&lt;/P&gt;&lt;P&gt;Is that the right way to go or can/should I launch the file from within the macro?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 11:56:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595343#M220502</guid>
      <dc:creator />
      <dc:date>2014-05-06T11:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: write variable to file using macro</title>
      <link>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595344#M220503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please have a look at the attached qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of creating the file in the temp folder I would like to launch the file or string directly from in memory so that I can avoid macro security issues when trying to write to disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub createFileAndOpen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; link = ActiveDocument.Evaluate("=$(vLink)")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIM fso, MyFile, strFile, strText&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strFile="c:\temp\link.msgFile"&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If fso.FileExists(strFile) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MyFile = fso.OpenTextFile (strFile, 2, True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set MyFile = fso.CreateTextFile(strFile)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFile.WriteLine(link)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenFile()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyFile.Close&lt;/P&gt;&lt;P&gt;End Sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION OpenFile&lt;/P&gt;&lt;P&gt;set app = ActiveDocument.GetApplication&lt;/P&gt;&lt;P&gt;app.Launch "C:\temp\link.msgFile", "file path"&lt;/P&gt;&lt;P&gt;END FUNCTION&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 11:30:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/write-variable-to-file-using-macro/m-p/595344#M220503</guid>
      <dc:creator />
      <dc:date>2014-05-09T11:30:12Z</dc:date>
    </item>
  </channel>
</rss>

