<?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: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310163#M60283</link>
    <description>Well, OK. I didn't know (yet) how to use Windows API (some good&lt;BR /&gt;
documentation anywhere?). Did this fully solve the problem meaning searching&lt;BR /&gt;
multiple file types once?&lt;BR /&gt;
&lt;BR /&gt;
Otherwise, my aplication already and usually use Excel for exporting -&lt;BR /&gt;
importing data for many other purposes, but this older code stop running&lt;BR /&gt;
corectly because of upgrading to XP.&lt;BR /&gt;
&amp;gt; XP did not digress, you&lt;BR /&gt;
&amp;gt; did by accessing it as opposed to 2000 which has a lesser load on your&lt;BR /&gt;
&amp;gt; memory.&lt;BR /&gt;
If this mean that I have not enough memory resources, well, my computer is&lt;BR /&gt;
1.7 Ghz and 1 GB Ram. Should be enough ... for a while.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message&lt;BR /&gt;
news:MPG.19e4ca75fe072b88989783@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt; Use Window's api. Never open another app to provide functionality that&lt;BR /&gt;
&amp;gt; you don't have by default in your current app. XP did not digress, you&lt;BR /&gt;
&amp;gt; did by accessing it as opposed to 2000 which has a lesser load on your&lt;BR /&gt;
&amp;gt; memory.&lt;BR /&gt;
&amp;gt; ___________________________&lt;BR /&gt;
&amp;gt; Mike Tuersley&lt;BR /&gt;
&amp;gt; AutoCAD Clinic&lt;BR /&gt;
&amp;gt; Rand IMAGINiT Technologies&lt;/MTUERSLEY&gt;</description>
    <pubDate>Thu, 02 Oct 2003 22:55:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-10-02T22:55:43Z</dc:date>
    <item>
      <title>Finding files using VBA and Office components</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310160#M60280</link>
      <description>FileSearch is a member of Office library, eg you have to refer in your&lt;BR /&gt;
project to Microsoft Office 9.0 Object Library (MSO9.dll or something like&lt;BR /&gt;
this) to have acces to it.&lt;BR /&gt;
Usualy I use like this:&lt;BR /&gt;
____&lt;BR /&gt;
Dim OfficeRef As Object&lt;BR /&gt;
Set OfficeRef = CreateObject("Excel.Application")&lt;BR /&gt;
With OfficeRef.FileSearch&lt;BR /&gt;
        .NewSearch&lt;BR /&gt;
        .LookIn = "D:\" ' or whatever&lt;BR /&gt;
        .SearchSubFolders = True  ' or False&lt;BR /&gt;
        .FileName = "*.dwg; *.tif; *.gif; *.dxf" ' here is the problem&lt;BR /&gt;
    If .Execute() &amp;gt; 0 Then&lt;BR /&gt;
        For i = 1 To .FoundFiles.Count&lt;BR /&gt;
            MsgBox .FoundFiles(i)&lt;BR /&gt;
        Next i&lt;BR /&gt;
    End If&lt;BR /&gt;
End With&lt;BR /&gt;
------&lt;BR /&gt;
"        .FileName = "*.dwg; *.tif; *.gif; *.dxf"     " it works only in&lt;BR /&gt;
Office 2000 and previous. I think that Office XP not longer support this&lt;BR /&gt;
usage and return only ".dwg" files (after a long time and maibe because this&lt;BR /&gt;
is the first in the list).&lt;BR /&gt;
Of course I still want to use this code because is faster instead of using&lt;BR /&gt;
something like this:&lt;BR /&gt;
______&lt;BR /&gt;
With OfficeRef.FileSearch&lt;BR /&gt;
....&lt;BR /&gt;
        .FileName = "*.dwg"&lt;BR /&gt;
End With&lt;BR /&gt;
'And again&lt;BR /&gt;
With OfficeRef.FileSearch&lt;BR /&gt;
....&lt;BR /&gt;
        .FileName = "*.tif"&lt;BR /&gt;
End With&lt;BR /&gt;
'etc&lt;BR /&gt;
--------&lt;BR /&gt;
In huge directories the fist code is taking less than 2 minutes and the&lt;BR /&gt;
second about 14 minutes.&lt;BR /&gt;
Does anybody have some ideea of still using this in Office XP (and why did&lt;BR /&gt;
they regress :o);)?&lt;BR /&gt;
Sugestion: We can add custom built-in constants in .FileType member of this&lt;BR /&gt;
object?&lt;BR /&gt;
&lt;BR /&gt;
Mihai</description>
      <pubDate>Tue, 30 Sep 2003 23:39:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310160#M60280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-09-30T23:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files using VBA and Office components</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310161#M60281</link>
      <description>Using another application to search for files is, in my opinion, a bit&lt;BR /&gt;
extreme. When this application is Excel...&lt;BR /&gt;
&lt;BR /&gt;
Take a look at the scripting component. You'll find it under references as&lt;BR /&gt;
Microsoft Scripting Runtime.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Rune Wold&lt;BR /&gt;
Take the dog for a walk to reply&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
"mihai" &lt;MIHAI.NAFORNITA&gt; wrote in message&lt;BR /&gt;
news:9FD4D6FED3CCFA2453A9632FE69C4D57@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; FileSearch is a member of Office library, eg you have to refer in your&lt;BR /&gt;
&amp;gt; project to Microsoft Office 9.0 Object Library (MSO9.dll or something like&lt;BR /&gt;
&amp;gt; this) to have acces to it.&lt;BR /&gt;
&amp;gt; Usualy I use like this:&lt;BR /&gt;
&amp;gt; ____&lt;BR /&gt;
&amp;gt; Dim OfficeRef As Object&lt;BR /&gt;
&amp;gt; Set OfficeRef = CreateObject("Excel.Application")&lt;BR /&gt;
&amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt;         .NewSearch&lt;BR /&gt;
&amp;gt;         .LookIn = "D:\" ' or whatever&lt;BR /&gt;
&amp;gt;         .SearchSubFolders = True  ' or False&lt;BR /&gt;
&amp;gt;         .FileName = "*.dwg; *.tif; *.gif; *.dxf" ' here is the problem&lt;BR /&gt;
&amp;gt;     If .Execute() &amp;gt; 0 Then&lt;BR /&gt;
&amp;gt;         For i = 1 To .FoundFiles.Count&lt;BR /&gt;
&amp;gt;             MsgBox .FoundFiles(i)&lt;BR /&gt;
&amp;gt;         Next i&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt; ------&lt;BR /&gt;
&amp;gt; "        .FileName = "*.dwg; *.tif; *.gif; *.dxf"     " it works only in&lt;BR /&gt;
&amp;gt; Office 2000 and previous. I think that Office XP not longer support this&lt;BR /&gt;
&amp;gt; usage and return only ".dwg" files (after a long time and maibe because&lt;BR /&gt;
this&lt;BR /&gt;
&amp;gt; is the first in the list).&lt;BR /&gt;
&amp;gt; Of course I still want to use this code because is faster instead of using&lt;BR /&gt;
&amp;gt; something like this:&lt;BR /&gt;
&amp;gt; ______&lt;BR /&gt;
&amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt; ....&lt;BR /&gt;
&amp;gt;         .FileName = "*.dwg"&lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt; 'And again&lt;BR /&gt;
&amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt; ....&lt;BR /&gt;
&amp;gt;         .FileName = "*.tif"&lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt; 'etc&lt;BR /&gt;
&amp;gt; --------&lt;BR /&gt;
&amp;gt; In huge directories the fist code is taking less than 2 minutes and the&lt;BR /&gt;
&amp;gt; second about 14 minutes.&lt;BR /&gt;
&amp;gt; Does anybody have some ideea of still using this in Office XP (and why did&lt;BR /&gt;
&amp;gt; they regress :o);)?&lt;BR /&gt;
&amp;gt; Sugestion: We can add custom built-in constants in .FileType member of&lt;BR /&gt;
this&lt;BR /&gt;
&amp;gt; object?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Mihai&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/MIHAI.NAFORNITA&gt;</description>
      <pubDate>Wed, 01 Oct 2003 02:25:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310161#M60281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-01T02:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Finding files using VBA and Office components</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310162#M60282</link>
      <description>Use Window's api. Never open another app to provide functionality that &lt;BR /&gt;
you don't have by default in your current app. XP did not digress, you &lt;BR /&gt;
did by accessing it as opposed to 2000 which has a lesser load on your &lt;BR /&gt;
memory.&lt;BR /&gt;
___________________________&lt;BR /&gt;
Mike Tuersley&lt;BR /&gt;
AutoCAD Clinic&lt;BR /&gt;
Rand IMAGINiT Technologies</description>
      <pubDate>Wed, 01 Oct 2003 08:27:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310162#M60282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-01T08:27:41Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310163#M60283</link>
      <description>Well, OK. I didn't know (yet) how to use Windows API (some good&lt;BR /&gt;
documentation anywhere?). Did this fully solve the problem meaning searching&lt;BR /&gt;
multiple file types once?&lt;BR /&gt;
&lt;BR /&gt;
Otherwise, my aplication already and usually use Excel for exporting -&lt;BR /&gt;
importing data for many other purposes, but this older code stop running&lt;BR /&gt;
corectly because of upgrading to XP.&lt;BR /&gt;
&amp;gt; XP did not digress, you&lt;BR /&gt;
&amp;gt; did by accessing it as opposed to 2000 which has a lesser load on your&lt;BR /&gt;
&amp;gt; memory.&lt;BR /&gt;
If this mean that I have not enough memory resources, well, my computer is&lt;BR /&gt;
1.7 Ghz and 1 GB Ram. Should be enough ... for a while.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Mike Tuersley" &lt;MTUERSLEY&gt; wrote in message&lt;BR /&gt;
news:MPG.19e4ca75fe072b88989783@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt; Use Window's api. Never open another app to provide functionality that&lt;BR /&gt;
&amp;gt; you don't have by default in your current app. XP did not digress, you&lt;BR /&gt;
&amp;gt; did by accessing it as opposed to 2000 which has a lesser load on your&lt;BR /&gt;
&amp;gt; memory.&lt;BR /&gt;
&amp;gt; ___________________________&lt;BR /&gt;
&amp;gt; Mike Tuersley&lt;BR /&gt;
&amp;gt; AutoCAD Clinic&lt;BR /&gt;
&amp;gt; Rand IMAGINiT Technologies&lt;/MTUERSLEY&gt;</description>
      <pubDate>Thu, 02 Oct 2003 22:55:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310163#M60283</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-02T22:55:43Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310164#M60284</link>
      <description>My aplication already and usually use Excel for exporting -&lt;BR /&gt;
importing data for many other purposes, but this older code stop running&lt;BR /&gt;
corectly because of upgrading to XP.&lt;BR /&gt;
Microsoft Scripting Runtime Class does not contain any member/method for&lt;BR /&gt;
searching files (or is my mistake)?&lt;BR /&gt;
&lt;BR /&gt;
"Rune Wold" &lt;RUNE&gt; wrote in message&lt;BR /&gt;
news:7580CB1BF4F7509429F8299BB0F1DAEB@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Using another application to search for files is, in my opinion, a bit&lt;BR /&gt;
&amp;gt; extreme. When this application is Excel...&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Take a look at the scripting component. You'll find it under references as&lt;BR /&gt;
&amp;gt; Microsoft Scripting Runtime.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Rune Wold&lt;BR /&gt;
&amp;gt; Take the dog for a walk to reply&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; "mihai" &lt;MIHAI.NAFORNITA&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:9FD4D6FED3CCFA2453A9632FE69C4D57@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; FileSearch is a member of Office library, eg you have to refer in your&lt;BR /&gt;
&amp;gt; &amp;gt; project to Microsoft Office 9.0 Object Library (MSO9.dll or something&lt;BR /&gt;
like&lt;BR /&gt;
&amp;gt; &amp;gt; this) to have acces to it.&lt;BR /&gt;
&amp;gt; &amp;gt; Usualy I use like this:&lt;BR /&gt;
&amp;gt; &amp;gt; ____&lt;BR /&gt;
&amp;gt; &amp;gt; Dim OfficeRef As Object&lt;BR /&gt;
&amp;gt; &amp;gt; Set OfficeRef = CreateObject("Excel.Application")&lt;BR /&gt;
&amp;gt; &amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt; &amp;gt;         .NewSearch&lt;BR /&gt;
&amp;gt; &amp;gt;         .LookIn = "D:\" ' or whatever&lt;BR /&gt;
&amp;gt; &amp;gt;         .SearchSubFolders = True  ' or False&lt;BR /&gt;
&amp;gt; &amp;gt;         .FileName = "*.dwg; *.tif; *.gif; *.dxf" ' here is the problem&lt;BR /&gt;
&amp;gt; &amp;gt;     If .Execute() &amp;gt; 0 Then&lt;BR /&gt;
&amp;gt; &amp;gt;         For i = 1 To .FoundFiles.Count&lt;BR /&gt;
&amp;gt; &amp;gt;             MsgBox .FoundFiles(i)&lt;BR /&gt;
&amp;gt; &amp;gt;         Next i&lt;BR /&gt;
&amp;gt; &amp;gt;     End If&lt;BR /&gt;
&amp;gt; &amp;gt; End With&lt;BR /&gt;
&amp;gt; &amp;gt; ------&lt;BR /&gt;
&amp;gt; &amp;gt; "        .FileName = "*.dwg; *.tif; *.gif; *.dxf"     " it works only in&lt;BR /&gt;
&amp;gt; &amp;gt; Office 2000 and previous. I think that Office XP not longer support this&lt;BR /&gt;
&amp;gt; &amp;gt; usage and return only ".dwg" files (after a long time and maibe because&lt;BR /&gt;
&amp;gt; this&lt;BR /&gt;
&amp;gt; &amp;gt; is the first in the list).&lt;BR /&gt;
&amp;gt; &amp;gt; Of course I still want to use this code because is faster instead of&lt;BR /&gt;
using&lt;BR /&gt;
&amp;gt; &amp;gt; something like this:&lt;BR /&gt;
&amp;gt; &amp;gt; ______&lt;BR /&gt;
&amp;gt; &amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt; &amp;gt; ....&lt;BR /&gt;
&amp;gt; &amp;gt;         .FileName = "*.dwg"&lt;BR /&gt;
&amp;gt; &amp;gt; End With&lt;BR /&gt;
&amp;gt; &amp;gt; 'And again&lt;BR /&gt;
&amp;gt; &amp;gt; With OfficeRef.FileSearch&lt;BR /&gt;
&amp;gt; &amp;gt; ....&lt;BR /&gt;
&amp;gt; &amp;gt;         .FileName = "*.tif"&lt;BR /&gt;
&amp;gt; &amp;gt; End With&lt;BR /&gt;
&amp;gt; &amp;gt; 'etc&lt;BR /&gt;
&amp;gt; &amp;gt; --------&lt;BR /&gt;
&amp;gt; &amp;gt; In huge directories the fist code is taking less than 2 minutes and the&lt;BR /&gt;
&amp;gt; &amp;gt; second about 14 minutes.&lt;BR /&gt;
&amp;gt; &amp;gt; Does anybody have some ideea of still using this in Office XP (and why&lt;BR /&gt;
did&lt;BR /&gt;
&amp;gt; &amp;gt; they regress :o);)?&lt;BR /&gt;
&amp;gt; &amp;gt; Sugestion: We can add custom built-in constants in .FileType member of&lt;BR /&gt;
&amp;gt; this&lt;BR /&gt;
&amp;gt; &amp;gt; object?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Mihai&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/MIHAI.NAFORNITA&gt;&lt;/RUNE&gt;</description>
      <pubDate>Thu, 02 Oct 2003 23:05:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310164#M60284</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-02T23:05:22Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310165#M60285</link>
      <description>I use the Scripting Runtime because I find it the simplest but aparently the best method is the Windows API. Anyhow this may get you started:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
Private Sub GetFiles(strPath As String, strFile As String, blnSearchSub as Boolean)&lt;BR /&gt;
Dim objFSO As Scripting.FileSystemObject&lt;BR /&gt;
Dim objFolder As Scripting.Folder&lt;BR /&gt;
Dim objFile As Scripting.File&lt;BR /&gt;
Dim objSubDirs As Scripting.Folders&lt;BR /&gt;
Dim objLoopFolder As Scripting.Folder&lt;BR /&gt;
Set objFSO = New Scripting.FileSystemObject&lt;BR /&gt;
Set objFolder = objFSO.GetFolder(strPath)&lt;BR /&gt;
If objFolder.Path &amp;lt;&amp;gt; "C:\System Volume Information" Then&lt;BR /&gt;
    For Each objFile In objFolder.Files&lt;BR /&gt;
        If objFile.Name Like strFile = True Then&lt;BR /&gt;
&lt;BR /&gt;
            &amp;#145;do something with the file&lt;BR /&gt;
&lt;BR /&gt;
        End If&lt;BR /&gt;
    Next objFile&lt;BR /&gt;
    If blnSearchSub = True&lt;BR /&gt;
        Set objSubDirs = objFolder.SubFolders&lt;BR /&gt;
        For Each objLoopFolder In objSubDirs&lt;BR /&gt;
            Call GetFiles(objLoopFolder.Path, strFile, True)&lt;BR /&gt;
        Next objLoopFolder&lt;BR /&gt;
    End if &lt;BR /&gt;
End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
Regards - Nathan</description>
      <pubDate>Thu, 02 Oct 2003 23:05:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310165#M60285</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-02T23:05:22Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310166#M60286</link>
      <description>Use "Option Compare Text" in your general declarations.</description>
      <pubDate>Thu, 02 Oct 2003 23:05:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/finding-files-using-vba-and-office-components/m-p/310166#M60286</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-10-02T23:05:22Z</dc:date>
    </item>
  </channel>
</rss>

