<?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 Application.OpenDoc with variable not working in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Application-OpenDoc-with-variable-not-working/m-p/500636#M692778</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 open a set of documents via macro (vbscript) in a button, using a user selected value in a field as document path and name, but keeps giving me "Failed to open document", if I replace de variable for fixed text it works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;QV 10.0.9061.7 SR3 64bit&lt;/P&gt;&lt;P&gt;Windows 2008 R2 server standar 64 bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_13787581468502335 jive_text_macro jive_macro_code" jivemacro_uid="_13787581468502335"&gt;
&lt;P&gt;sub Macro1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;set doc1 = ActiveDocument&lt;/P&gt;
&lt;P&gt;set SelectedValueInDocument = doc1.fields("xDocuments").GetSelectedValues&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'Note: the button is active only if GetSelectedCount('xDocuments')=1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if SelectedValueInDocument.Count &amp;gt; 1 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox "Warning: there is more than 1 value selected"&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;vDoc = SelectedValueInDocument.Item(0).text&lt;/P&gt;
&lt;P&gt;msgbox&amp;nbsp; vDoc&amp;nbsp;&amp;nbsp; 'here shows correct path and document name (the name has no spaces, backslash, comma, colon or semi colon)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;set App = doc1.GetApplication&lt;/P&gt;
&lt;P&gt;set newdoc = App.OpenDoc (vDoc,"","")&amp;nbsp;&amp;nbsp; ''&amp;nbsp; &amp;lt;&amp;lt;== this gives error&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'set newdoc = App.OpenDoc ("C:\QV\DESA\APPS\common\QVW\MyChileDocument[6-2].qvw","","")&amp;nbsp; '&amp;lt;- this works but need to change document&amp;nbsp; to match user selection&lt;/P&gt;
&lt;P&gt;newdoc.Activate&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &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;&amp;nbsp; '&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;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas why get error with the variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Sep 2013 20:00:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-09-09T20:00:47Z</dc:date>
    <item>
      <title>Application.OpenDoc with variable not working</title>
      <link>https://community.qlik.com/t5/QlikView/Application-OpenDoc-with-variable-not-working/m-p/500636#M692778</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 open a set of documents via macro (vbscript) in a button, using a user selected value in a field as document path and name, but keeps giving me "Failed to open document", if I replace de variable for fixed text it works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;QV 10.0.9061.7 SR3 64bit&lt;/P&gt;&lt;P&gt;Windows 2008 R2 server standar 64 bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_13787581468502335 jive_text_macro jive_macro_code" jivemacro_uid="_13787581468502335"&gt;
&lt;P&gt;sub Macro1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;set doc1 = ActiveDocument&lt;/P&gt;
&lt;P&gt;set SelectedValueInDocument = doc1.fields("xDocuments").GetSelectedValues&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'Note: the button is active only if GetSelectedCount('xDocuments')=1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if SelectedValueInDocument.Count &amp;gt; 1 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgbox "Warning: there is more than 1 value selected"&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;vDoc = SelectedValueInDocument.Item(0).text&lt;/P&gt;
&lt;P&gt;msgbox&amp;nbsp; vDoc&amp;nbsp;&amp;nbsp; 'here shows correct path and document name (the name has no spaces, backslash, comma, colon or semi colon)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;set App = doc1.GetApplication&lt;/P&gt;
&lt;P&gt;set newdoc = App.OpenDoc (vDoc,"","")&amp;nbsp;&amp;nbsp; ''&amp;nbsp; &amp;lt;&amp;lt;== this gives error&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'set newdoc = App.OpenDoc ("C:\QV\DESA\APPS\common\QVW\MyChileDocument[6-2].qvw","","")&amp;nbsp; '&amp;lt;- this works but need to change document&amp;nbsp; to match user selection&lt;/P&gt;
&lt;P&gt;newdoc.Activate&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &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;&amp;nbsp; '&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;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas why get error with the variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 20:00:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Application-OpenDoc-with-variable-not-working/m-p/500636#M692778</guid>
      <dc:creator />
      <dc:date>2013-09-09T20:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Application.OpenDoc with variable not working</title>
      <link>https://community.qlik.com/t5/QlikView/Application-OpenDoc-with-variable-not-working/m-p/500637#M692779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found it. &lt;/P&gt;&lt;P&gt;I Had some characters along the way who apparently did not like. delete some "'- []" in the name and path and now it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 20:26:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Application-OpenDoc-with-variable-not-working/m-p/500637#M692779</guid>
      <dc:creator />
      <dc:date>2013-09-09T20:26:26Z</dc:date>
    </item>
  </channel>
</rss>

