<?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: VBA check if folder exists in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377643#M420407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since macros in QlikView is using VBScript (or JScript) you don't have the Visual Basic for Applications function called Dir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative is to use the FileSystemObject in Windows like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15129303957696482 jive_text_macro" jivemacro_uid="_15129303957696482" modifiedtitle="true"&gt;
&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt;"&gt;foldername = "C:\Program Files (x86)"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;On Error Resume Next&lt;/P&gt;
&lt;P&gt;Set f = fso.GetFolder(foldername)&lt;/P&gt;
&lt;P&gt;On Error Goto 0&lt;/P&gt;
&lt;P&gt;MsgBox "The folder [" &amp;amp; foldername &amp;amp; "] do " &amp;amp; Left("NOT",(Len(f)=0)*-3) &amp;amp; " exist" &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to turn off error messages before the GetFolder function call as it throws an error if not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line #3 turns errors off and line #5 turns them on again (as you probably know ... ) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 10 Dec 2017 18:28:16 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2017-12-10T18:28:16Z</dc:date>
    <item>
      <title>VBA check if folder exists</title>
      <link>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377642#M420406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Community.&lt;/P&gt;&lt;P&gt;I found way to check in VBA if folder exists on PC, but it works only in Excel VBA:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;sub Check&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If Dir("C:\My Documents\") &amp;lt;&amp;gt; "" Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;MsgBox "Yes, path exists"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;MsgBox "No, path does not exist."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;end sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Is there any way to check this stuff in QlikView macro?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Dec 2017 18:11:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377642#M420406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-10T18:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: VBA check if folder exists</title>
      <link>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377643#M420407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since macros in QlikView is using VBScript (or JScript) you don't have the Visual Basic for Applications function called Dir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative is to use the FileSystemObject in Windows like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15129303957696482 jive_text_macro" jivemacro_uid="_15129303957696482" modifiedtitle="true"&gt;
&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt;"&gt;foldername = "C:\Program Files (x86)"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;On Error Resume Next&lt;/P&gt;
&lt;P&gt;Set f = fso.GetFolder(foldername)&lt;/P&gt;
&lt;P&gt;On Error Goto 0&lt;/P&gt;
&lt;P&gt;MsgBox "The folder [" &amp;amp; foldername &amp;amp; "] do " &amp;amp; Left("NOT",(Len(f)=0)*-3) &amp;amp; " exist" &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to turn off error messages before the GetFolder function call as it throws an error if not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Line #3 turns errors off and line #5 turns them on again (as you probably know ... ) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Dec 2017 18:28:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377643#M420407</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2017-12-10T18:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: VBA check if folder exists</title>
      <link>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377644#M420408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wonderful!&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Dec 2017 18:46:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/VBA-check-if-folder-exists/m-p/1377644#M420408</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-10T18:46:07Z</dc:date>
    </item>
  </channel>
</rss>

