<?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 Problem with FileSystemObject in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-FileSystemObject/m-p/166099#M38166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i have a function for printing repots in pdf file.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Function PrintReportPDF(oReport, pdfOutputFile)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ActiveDocument.PrintReport oReport, "PDF-XChange 3.0", false&lt;BR /&gt; Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;&lt;BR /&gt; objFSO. &lt;STRONG&gt;MoveFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf", pdfOutputFile&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; but this leads to a problem, if the destination file already exist, the parameter 'true' won't work.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;objFSO. &lt;STRONG&gt;CopyFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf", pdfOutputFile, True&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; the problem: the tempfile QlikView Printing.pdf would not be deleted. If I run the macro a 2nd time, I got the questeion to overwrite. I wan't to avoid some interactions.&lt;/P&gt;&lt;P&gt;If I try to delete the tempfile after &lt;STRONG&gt;&lt;EM&gt;CopyFile&lt;/EM&gt;&lt;/STRONG&gt; with:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;objFSO. &lt;STRONG&gt;DeleteFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf"&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; I got the errormessage, that the file does not exist. (I think the macro tries to delete the file, before the step before is finished)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End Function&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I think, I need an error handling in such a way, that I have to check, wether the destination file exist, then delete it. But since I'm not a programmer, how can I solve it?&lt;/P&gt;&lt;P&gt;Or does someone has a better solution?&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Stefan Bockelmann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jan 2011 16:46:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-01-12T16:46:54Z</dc:date>
    <item>
      <title>Problem with FileSystemObject</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FileSystemObject/m-p/166099#M38166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i have a function for printing repots in pdf file.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Function PrintReportPDF(oReport, pdfOutputFile)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ActiveDocument.PrintReport oReport, "PDF-XChange 3.0", false&lt;BR /&gt; Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;&lt;BR /&gt; objFSO. &lt;STRONG&gt;MoveFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf", pdfOutputFile&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; but this leads to a problem, if the destination file already exist, the parameter 'true' won't work.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;objFSO. &lt;STRONG&gt;CopyFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf", pdfOutputFile, True&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; the problem: the tempfile QlikView Printing.pdf would not be deleted. If I run the macro a 2nd time, I got the questeion to overwrite. I wan't to avoid some interactions.&lt;/P&gt;&lt;P&gt;If I try to delete the tempfile after &lt;STRONG&gt;&lt;EM&gt;CopyFile&lt;/EM&gt;&lt;/STRONG&gt; with:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;objFSO. &lt;STRONG&gt;DeleteFile&lt;/STRONG&gt; "C:\Temp\QlikView Printing.pdf"&lt;BR /&gt;&lt;/EM&gt;==&amp;gt; I got the errormessage, that the file does not exist. (I think the macro tries to delete the file, before the step before is finished)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End Function&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I think, I need an error handling in such a way, that I have to check, wether the destination file exist, then delete it. But since I'm not a programmer, how can I solve it?&lt;/P&gt;&lt;P&gt;Or does someone has a better solution?&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Stefan Bockelmann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 16:46:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FileSystemObject/m-p/166099#M38166</guid>
      <dc:creator />
      <dc:date>2011-01-12T16:46:54Z</dc:date>
    </item>
  </channel>
</rss>

