<?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 Cancel button in MsgBox in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cancel-button-in-MsgBox/m-p/150726#M28698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everybody,&lt;/P&gt;&lt;P&gt;I have the following code executed in a macro button:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Sub SelectUA&lt;BR /&gt;set s = ActiveDocument.Fields("UA").GetPossibleValues&lt;BR /&gt; for i=0 to s.Count-1&lt;BR /&gt; m = s.Item(i).Text&lt;BR /&gt; ActiveDocument.Fields("UA").Select m&lt;BR /&gt; ActiveDocument.GetApplication.Refresh&lt;BR /&gt; ActiveDocument.GetApplication.WaitForIdle&lt;BR /&gt; tp = ActiveDocument.GetApplication.MsgBox (m,1)&lt;BR /&gt; if tp = 1 then&lt;BR /&gt; exit for&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; ActiveDocument.Fields("UA").Clear&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;the problem is that the MsgBox function allways return a 0 (OK or CANCEL pressed) so the Sub executes until the end of the for loop.&lt;/P&gt;&lt;P&gt;How can I solve this problem ?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jul 2009 21:42:07 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-30T21:42:07Z</dc:date>
    <item>
      <title>Cancel button in MsgBox</title>
      <link>https://community.qlik.com/t5/QlikView/Cancel-button-in-MsgBox/m-p/150726#M28698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everybody,&lt;/P&gt;&lt;P&gt;I have the following code executed in a macro button:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Sub SelectUA&lt;BR /&gt;set s = ActiveDocument.Fields("UA").GetPossibleValues&lt;BR /&gt; for i=0 to s.Count-1&lt;BR /&gt; m = s.Item(i).Text&lt;BR /&gt; ActiveDocument.Fields("UA").Select m&lt;BR /&gt; ActiveDocument.GetApplication.Refresh&lt;BR /&gt; ActiveDocument.GetApplication.WaitForIdle&lt;BR /&gt; tp = ActiveDocument.GetApplication.MsgBox (m,1)&lt;BR /&gt; if tp = 1 then&lt;BR /&gt; exit for&lt;BR /&gt; end if&lt;BR /&gt; next&lt;BR /&gt; ActiveDocument.Fields("UA").Clear&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;the problem is that the MsgBox function allways return a 0 (OK or CANCEL pressed) so the Sub executes until the end of the for loop.&lt;/P&gt;&lt;P&gt;How can I solve this problem ?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 21:42:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cancel-button-in-MsgBox/m-p/150726#M28698</guid>
      <dc:creator />
      <dc:date>2009-07-30T21:42:07Z</dc:date>
    </item>
    <item>
      <title>Cancel button in MsgBox</title>
      <link>https://community.qlik.com/t5/QlikView/Cancel-button-in-MsgBox/m-p/150727#M28699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I usually use the VB Script MsgBox. Try this in place of your MsgBox line:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;tp = MsgBox(m, 1)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That should give you a message box with m as the prompt and OK &amp;amp; Cancel buttons. Cancel should return a 2, Ok a 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 22:11:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cancel-button-in-MsgBox/m-p/150727#M28699</guid>
      <dc:creator />
      <dc:date>2009-07-30T22:11:35Z</dc:date>
    </item>
  </channel>
</rss>

