<?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 test if file exists in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341278#M98186</link>
    <description>Hello AutoCAD VBA Users,&lt;BR /&gt;
&lt;BR /&gt;
How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&lt;BR /&gt;
Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
Before you buy.</description>
    <pubDate>Wed, 01 Dec 1999 01:03:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>1999-12-01T01:03:14Z</dc:date>
    <item>
      <title>test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341278#M98186</link>
      <description>Hello AutoCAD VBA Users,&lt;BR /&gt;
&lt;BR /&gt;
How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&lt;BR /&gt;
Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
Before you buy.</description>
      <pubDate>Wed, 01 Dec 1999 01:03:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341278#M98186</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>1999-12-01T01:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341279#M98187</link>
      <description>Hi!&lt;BR /&gt;
You can check for presence of a file by using "DIR" function.&lt;BR /&gt;
The function returns the file name if the file exists in the specified path&lt;BR /&gt;
or else it returns a zero length string.&lt;BR /&gt;
&lt;BR /&gt;
Check in VBA help for more information as you can do lot many things with&lt;BR /&gt;
this function.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
bye,&lt;BR /&gt;
&lt;BR /&gt;
P.Murali&lt;BR /&gt;
&lt;JEFFERYJJENSEN&gt; wrote in message&lt;BR /&gt;
news:821s4g$c79$1@nnrp1.deja.com...&lt;BR /&gt;
&amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; Before you buy.&lt;/JEFFERYJJENSEN&gt;</description>
      <pubDate>Wed, 01 Dec 1999 04:41:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341279#M98187</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>1999-12-01T04:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341280#M98188</link>
      <description>You can download ACADX.ARX from the customer-files &lt;BR /&gt;
newsgroup, and use its 'FindFile()' method.&lt;BR /&gt;
&lt;BR /&gt;
jefferyjjensen@my-deja.com wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; Before you buy.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
/*********************************************************/&lt;BR /&gt;
/*    Tony Tanzillo     Design Automation Consulting     */&lt;BR /&gt;
/* Programming &amp;amp; Customization for AutoCAD &amp;amp; Compatibles */&lt;BR /&gt;
/* ----------------------------------------------------- */&lt;BR /&gt;
/*            tony.tanzillo@worldnet.att.net             */&lt;BR /&gt;
/*    http://ourworld.compuserve.com/homepages/tonyt     */&lt;BR /&gt;
/*********************************************************/</description>
      <pubDate>Wed, 01 Dec 1999 05:38:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341280#M98188</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>1999-12-01T05:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341281#M98189</link>
      <description>jefferyjjensen@my-deja.com wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; Before you buy.&lt;BR /&gt;
&lt;BR /&gt;
  Another thing to try is to use error handling as well s the built in&lt;BR /&gt;
findfiles and dir stuff.&lt;BR /&gt;
eg&lt;BR /&gt;
on error resume next&lt;BR /&gt;
... do your stuff here ...say kill a file or attempt opening a file&lt;BR /&gt;
.... and if this triggers an error you can now check it thus&lt;BR /&gt;
if err.number&amp;lt;&amp;gt;0 then&lt;BR /&gt;
    ..do whatever you need to do if an error ocurred etc&lt;BR /&gt;
end if</description>
      <pubDate>Wed, 01 Dec 1999 15:41:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341281#M98189</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>1999-12-01T15:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341282#M98190</link>
      <description>Check out the Dir() function.  The online help is pretty clear.&lt;BR /&gt;
&lt;BR /&gt;
jefferyjjensen@my-deja.com wrote:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; Before you buy.</description>
      <pubDate>Wed, 01 Dec 1999 17:53:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341282#M98190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>1999-12-01T17:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: test if file exists</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341283#M98191</link>
      <description>'Add this code to the appropriate event:&lt;BR /&gt;
&lt;BR /&gt;
'success% = FileExists%("C:\vb\vb.exe") 'A full path and filename&lt;BR /&gt;
&lt;BR /&gt;
' FileExists% returns True if file exists&lt;BR /&gt;
'If success% = True Then&lt;BR /&gt;
'MsgBox "This file already exists." ', 48, File Error&lt;BR /&gt;
'Else&lt;BR /&gt;
'MsgBox "No File Found"&lt;BR /&gt;
'End If&lt;BR /&gt;
'End Sub&lt;BR /&gt;
'How to detect if a file already exists.&lt;BR /&gt;
'-------------------------------------------------------------------&lt;BR /&gt;
' To detect an existing file, use the function below:&lt;BR /&gt;
&lt;BR /&gt;
'Function FileExists%(fname$)&lt;BR /&gt;
'On Local Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
'Dim ff%&lt;BR /&gt;
'        ff% = FreeFile&lt;BR /&gt;
'        Open fname$ For Input As ff%&lt;BR /&gt;
&lt;BR /&gt;
'        If Err Then&lt;BR /&gt;
'        FileExists% = False&lt;BR /&gt;
'        Else&lt;BR /&gt;
'        FileExists% = True&lt;BR /&gt;
'        End If&lt;BR /&gt;
&lt;BR /&gt;
'        Close ff%&lt;BR /&gt;
&lt;BR /&gt;
'End Function&lt;BR /&gt;
&lt;BR /&gt;
&lt;JEFFERYJJENSEN&gt; wrote in message&lt;BR /&gt;
news:821s4g$c79$1@nnrp1.deja.com...&lt;BR /&gt;
&amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; Before you buy.&lt;/JEFFERYJJENSEN&gt;</description>
      <pubDate>Sat, 26 Feb 2000 20:45:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341283#M98191</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-26T20:45:34Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341284#M98192</link>
      <description>There is a simpler (and faster) way: use the Dir$ function. e.g.:&lt;BR /&gt;
Dir$("c:\program files\mdt\acad.exe") will return "acad.exe" if the file&lt;BR /&gt;
exists in that location or "" if it doesn't.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Visit me at: http://www2.stonemedia.com/franko&lt;BR /&gt;
&lt;BR /&gt;
"Jim Arthur" &lt;JIMARTHUR&gt; wrote in message&lt;BR /&gt;
news:899djs$8hs4@adesknews2.autodesk.com...&lt;BR /&gt;
&amp;gt; 'Add this code to the appropriate event:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'success% = FileExists%("C:\vb\vb.exe") 'A full path and filename&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ' FileExists% returns True if file exists&lt;BR /&gt;
&amp;gt; 'If success% = True Then&lt;BR /&gt;
&amp;gt; 'MsgBox "This file already exists." ', 48, File Error&lt;BR /&gt;
&amp;gt; 'Else&lt;BR /&gt;
&amp;gt; 'MsgBox "No File Found"&lt;BR /&gt;
&amp;gt; 'End If&lt;BR /&gt;
&amp;gt; 'End Sub&lt;BR /&gt;
&amp;gt; 'How to detect if a file already exists.&lt;BR /&gt;
&amp;gt; '-------------------------------------------------------------------&lt;BR /&gt;
&amp;gt; ' To detect an existing file, use the function below:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'Function FileExists%(fname$)&lt;BR /&gt;
&amp;gt; 'On Local Error Resume Next&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'Dim ff%&lt;BR /&gt;
&amp;gt; '        ff% = FreeFile&lt;BR /&gt;
&amp;gt; '        Open fname$ For Input As ff%&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; '        If Err Then&lt;BR /&gt;
&amp;gt; '        FileExists% = False&lt;BR /&gt;
&amp;gt; '        Else&lt;BR /&gt;
&amp;gt; '        FileExists% = True&lt;BR /&gt;
&amp;gt; '        End If&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; '        Close ff%&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; &lt;JEFFERYJJENSEN&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:821s4g$c79$1@nnrp1.deja.com...&lt;BR /&gt;
&amp;gt; &amp;gt; Hello AutoCAD VBA Users,&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; How do I test if a file exists? I have a For Loop that will open a DXF&lt;BR /&gt;
&amp;gt; &amp;gt; file (e.g. concatenate the loop number to the filename to come up with&lt;BR /&gt;
&amp;gt; &amp;gt; file1.dxf, file2.dxf, etc.), do some VBA changes, then save as DWG.&lt;BR /&gt;
&amp;gt; &amp;gt; Problem is I get an error message when a file doesn't exist.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Jeff Jensen, jjensen@co.clark.nv.us&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Sent via Deja.com http://www.deja.com/&lt;BR /&gt;
&amp;gt; &amp;gt; Before you buy.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/JEFFERYJJENSEN&gt;&lt;/JIMARTHUR&gt;</description>
      <pubDate>Sat, 26 Feb 2000 20:45:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/test-if-file-exists/m-p/341284#M98192</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-02-26T20:45:40Z</dc:date>
    </item>
  </channel>
</rss>

