<?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: bad file or number error while running the macro.. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747628#M453400</link>
    <description>&lt;P&gt;did not get it Marcus, can you please elaborate bit more with an example ...&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 09:51:24 GMT</pubDate>
    <dc:creator>dhasharadh</dc:creator>
    <dc:date>2020-09-28T09:51:24Z</dc:date>
    <item>
      <title>bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747486#M453392</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;every thing was fine until we did this&amp;nbsp; small change in the macro, now there is a error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear experts&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/18624"&gt;@Gysbert_Wassenaar&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22381"&gt;@Miguel_Angel_Baeyens&lt;/a&gt;&amp;nbsp;@&amp;nbsp;&amp;nbsp;can any of you look into this error please.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the below macro generate 2 text files and we are trying to place the generated text files in the&amp;nbsp;\\qlkvapps001.flip.onmicrosoft.com\WUR folder for which we added few lines line Dim FilePath and that's it.&lt;/P&gt;&lt;P&gt;am getting&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;bad file name or number&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;error and this line is getting highlighted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set MyFile = fso.CreateTextFile(strFile)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full Macro :&lt;/P&gt;&lt;P&gt;Sub export&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;curMonth = Month( DateAdd("M",-1, Date))&lt;BR /&gt;if curMonth&amp;lt;10 then curMonthS="0" &amp;amp; CStr(curMonth) else curMonthS=CStr(curMonth)&lt;BR /&gt;IF curMonth=1 OR curMonth=3 OR curMonth=5 OR curMonth=7 OR curMonth=8 OR curMonth=10 OR curMonth=12 Then&lt;BR /&gt;noofdays=31&lt;BR /&gt;else noofdays=30&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;Dim wellNames(2)&lt;BR /&gt;wellNames(0)="Eschenfelden US"&lt;BR /&gt;wellNames(1)="Bierwang US"&lt;/P&gt;&lt;P&gt;Dim FileNames(2)&lt;BR /&gt;FileNames(0)="Esch"&lt;BR /&gt;FileNames(1)="Biew"&lt;/P&gt;&lt;P&gt;Dim FilePath(1)&lt;BR /&gt;FilePath(1) = "\\qlkvapps001.flip.onmicrosoft.com\WUR"&lt;/P&gt;&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;For i = 0 to 1&lt;BR /&gt;ActiveDocument.Fields("%KEY_REPORT").Select WCONHIST,WCONINJH&lt;BR /&gt;ActiveDocument.Fields("GASMONTH").Select Year(Date)&amp;amp;"-"&amp;amp;curMonthS&lt;BR /&gt;ActiveDocument.Fields("SP.LANGBEZ_SSO_SPEICHER").Select wellNames(i)&lt;BR /&gt;&lt;BR /&gt;strFile = FilePath(i) &amp;amp; FileNames(i) &amp;amp; "_UGS_01_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; noofdays &amp;amp; "_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; Year(Date) &amp;amp; ".txt"&lt;BR /&gt;&lt;BR /&gt;Set MyFile = fso.CreateTextFile(strFile)&lt;BR /&gt;&lt;BR /&gt;set table = ActiveDocument.GetSheetObject( "TB02" )&lt;BR /&gt;for RowIter = 0 to table.GetRowCount-1&lt;BR /&gt;set cell = table.GetCell(RowIter,0)&lt;BR /&gt;MyFile.WriteLine(cell.Text)&lt;BR /&gt;next&lt;BR /&gt;MyFile.Close&lt;BR /&gt;Next&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;ActiveDocument.Save&lt;BR /&gt;ActiveDocument.GetApplication.Quit&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Dhasahradh&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:54:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747486#M453392</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2024-11-15T23:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747554#M453395</link>
      <description>&lt;P&gt;Put&amp;nbsp;&lt;SPAN&gt;\\qlkvapps001.flip.onmicrosoft.com\WUR within the windows explorer on the machine and with the user which executes the macro - does it work and you could see the folder and it's content? If yes, could you add some new content and change and delete it afterwards (just a new txt with test or similar as content)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Marcus&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 06:23:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747554#M453395</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-28T06:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747570#M453396</link>
      <description>&lt;P&gt;Thank you Marcus,&lt;/P&gt;&lt;P&gt;Yes am able to access the path manually and also able to edit and delete the text file which is pasted in the above location.&lt;/P&gt;&lt;P&gt;i just tested all this manually.&amp;nbsp; is that &lt;STRONG&gt;bad file name or number error&lt;/STRONG&gt; is due to any syntax error...??&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 06:55:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747570#M453396</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-28T06:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747610#M453399</link>
      <description>&lt;P&gt;I suggest to use a msgbox to output the final full-path because nearly all (variable) parts are dynamically and some may return a wrong/unexpected result. Especially take a look to:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FilePath(i)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;which has only one defined value but is called twice with i = 0 and i = 1 ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:03:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747610#M453399</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-28T09:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747628#M453400</link>
      <description>&lt;P&gt;did not get it Marcus, can you please elaborate bit more with an example ...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:51:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747628#M453400</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-28T09:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: bad file or number error while running the macro..</title>
      <link>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747715#M453403</link>
      <description>&lt;P&gt;With:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dim FilePath(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FilePath(1) = "\\qlkvapps001.flip.onmicrosoft.com\WUR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;you define FilePath as array and set only a single value. Now you ran a loop with i as loop-counter and 2 iterations and calls with it the FilePath:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For i = 0 to 1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;BR /&gt;&lt;BR /&gt;strFile = &lt;STRONG&gt;FilePath(i)&lt;/STRONG&gt; &amp;amp; FileNames(i) &amp;amp; "_UGS_01_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; noofdays &amp;amp; "_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; Year(Date) &amp;amp; ".txt"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but there is only one value for i = 1, i = 0 has no value and will be probably NULL and therefore there will be no valid path in this case. Just change this array to a normal variable respectively a const.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:13:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/bad-file-or-number-error-while-running-the-macro/m-p/1747715#M453403</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-28T13:13:18Z</dc:date>
    </item>
  </channel>
</rss>

