<?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: Calling VBScript macro from loadscript in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335999#M123926</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Miguel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;macro works fine when called frm QV desktop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event viewer shows Application hang as an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Apr 2012 09:34:32 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-04-12T09:34:32Z</dc:date>
    <item>
      <title>Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335988#M123915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created macro in Edit Module using VBScript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to call the same macro from EditScript.&lt;/P&gt;&lt;P&gt;Is this possible and if yes how?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 05:10:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335988#M123915</guid>
      <dc:creator />
      <dc:date>2012-04-04T05:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335989#M123916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;the script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; F1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;T2:&lt;BR /&gt;load *,test(F1) as F2 resident T;&lt;/P&gt;&lt;P&gt;drop table T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;the vbs&amp;nbsp; (macro):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function test (x)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test=x+1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end function &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 06:11:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335989#M123916</guid>
      <dc:creator />
      <dc:date>2012-04-04T06:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335990#M123917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Matan,&lt;/P&gt;&lt;P&gt;Thanks for you reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried above script. It gives error &lt;/P&gt;&lt;P&gt;Error in expression:&lt;/P&gt;&lt;P&gt;TEST is not a valid function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T2:&lt;/P&gt;&lt;P&gt;load *,test(F1) as F2 resident T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See I will explain u d functionality i need to achieve.&lt;/P&gt;&lt;P&gt;Basically after the qvw file gets reloaded, its PDF is to be created automatically for which i have written macro. I have set the action Run Macro on trigger OnPostReload and this works fine when I run the report on qlikview developer. &lt;/P&gt;&lt;P&gt;But when the same report is reloaded through qlikview server it does not fire the trigger after completion of reload.&lt;/P&gt;&lt;P&gt;I have also done the settings on server to allow macro execution. On qlikview community i found one more setting by pressing Ctrl+shift+m. I have also done that. &lt;/P&gt;&lt;P&gt;In spite of all these things macro is not getting executed on server. So i was trying if macros can be executed through edit script. I am using &lt;STRONG&gt;Qlikview 11.00 SR1 version and I dont have publisher.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let me know if I have to do any other settings or anything else is required.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Please help on this matter&amp;nbsp; &lt;STRONG&gt;ASAP. Its really very urgent.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank u in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 09:24:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335990#M123917</guid>
      <dc:creator />
      <dc:date>2012-04-04T09:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335991#M123918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can execute macro functions by doing something like this in your load script:&lt;BR /&gt;LET Execute = MyMacroSub();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where MyMacroSub is a function defined in your macro.&lt;/P&gt;&lt;P&gt;The hard part is that the macro will execute with the security of the user that runs your QVService, or Publisher if you had that. So this is a HUGE security risk as you would need to assign system access to the account running your services.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 09:42:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335991#M123918</guid>
      <dc:creator>Alexander_Thor</dc:creator>
      <dc:date>2012-04-04T09:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335992#M123919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I tried LET Execute = MyMacroSub(); (I put my macro name in place of MyMacroSub()) but it did not work.&lt;/P&gt;&lt;P&gt;Any other idea ???&lt;/P&gt;&lt;P&gt;Please reply &lt;STRONG&gt;ASAP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank u so much.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 10:15:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335992#M123919</guid>
      <dc:creator />
      <dc:date>2012-04-04T10:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335993#M123920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gah sorry, bit tired over here. You need to define it as a function in the macro instead of a subroutine.&lt;/P&gt;&lt;P&gt;Try this test macro and you should be able to execute it from your load script, works on my qv11 machine atleast &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro code:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Function CreateFolder() &lt;/P&gt;&lt;P&gt;Dim objFSO &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;objFSO.CreateFolder("C:\MacroTestFolder")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QlikView Load Script:&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;LET CreateFolder = CreateFolder();&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:00:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335993#M123920</guid>
      <dc:creator>Alexander_Thor</dc:creator>
      <dc:date>2012-04-04T11:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335994#M123921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;Thanks a lot for quick response. I really appreciate that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the two functions I am using for auto PDF generation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function printRP01()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveDocument.GetApplication.Sleep 2000&lt;/P&gt;&lt;P&gt;ActiveDocument.PrintReport "RP01", "PDF-Xchange 4.0", false &lt;/P&gt;&lt;P&gt;ActiveDocument.GetApplication.Sleep 20000&lt;/P&gt;&lt;P&gt;PrintReportPDF "MyReport"&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'===========================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function PrintReportPDF(pdfOutputFile)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;objFSO.CopyFile "D:\PDFGenerate\Report1.pdf" , "D:\PDFGenerate\" &amp;amp; pdfOutputFile &amp;amp; ".pdf", True&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;I tried what you have suggetsed in your above reply. But it did not execute printRP01() and also it did not give an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you plz brief what to do???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:33:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335994#M123921</guid>
      <dc:creator />
      <dc:date>2012-04-04T11:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335995#M123922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can anyone tell why it did not execute printRP01 function, but did execute the PrintReportPDF function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is wrong in first function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 09:00:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335995#M123922</guid>
      <dc:creator />
      <dc:date>2012-04-12T09:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335996#M123923</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;The code seems to be OK, but ActiveDocument is &lt;EM&gt;not available&lt;/EM&gt; when called from the load script, since the document only "exists" when the script has completely finished. So any call to ActiveDocument functions will not work (is not a bug but a design) if they are called from the script. Rather, you need to end the script then use a button or something similar to call them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround, you can use the qv.exe /r parameter and create a batch file that is triggered from the Windows Scheduler instead of the QlikView Server, and has an action OnOpen or OnPostReload that calls the macro instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense and helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 09:04:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335996#M123923</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-04-12T09:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335997#M123924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Miguel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did try for .bat file also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it gets hung when it executes the macro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 09:09:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335997#M123924</guid>
      <dc:creator />
      <dc:date>2012-04-12T09:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335998#M123925</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;Make sure the macro works fine when it's called from the QlikView Desktop opened locally, and make sure that the paths (D: drive in your code) is available for the user running the BAT file. Check the Windows Event Viewer to see whether it's throwing any error to the system just in case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 09:28:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335998#M123925</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-04-12T09:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335999#M123926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Miguel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;macro works fine when called frm QV desktop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event viewer shows Application hang as an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 09:34:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/335999#M123926</guid>
      <dc:creator />
      <dc:date>2012-04-12T09:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calling VBScript macro from loadscript</title>
      <link>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/336000#M123927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;I've tried to use the qv.exe /r method but it still doesn't trigger OnOpen or OnPostReload. Thoughts? QV 11 SR2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nevermind, it's working ... sometimes and not consistently.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2013 20:12:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calling-VBScript-macro-from-loadscript/m-p/336000#M123927</guid>
      <dc:creator>Rich-HHE</dc:creator>
      <dc:date>2013-01-31T20:12:05Z</dc:date>
    </item>
  </channel>
</rss>

