ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileSearch filter (https://www.excelbanter.com/excel-programming/340375-filesearch-filter.html)

AdmSteck

FileSearch filter
 
I'm building a custom file import macro to import csv files created by
another program. They are all saved with the file name format of
PartNumber~Machine.csv. I am trying to use the application.filesearch object
to return all the files for a part. I also need to show both the right and
left part numbers. Some example part numbers a

6562 Part 1 Right
6567 Part 1 Left
6561 Part 2 Right
6566 Part 2 Left
6081 Part 3 Right
6091 Part 3 Left
6061 Part 4 Right
6071 Part 4 Left

The problem is when I use wildcards in the .filename property of the
filesearch, it returns part 1 and 2, or 3 and 4. Is there any way to fix
this so it only shows both right and left of the part I want?

Peter T

FileSearch filter
 
Maybe something like

sPart = "Part 1"

..Filename = "?????" & sPart & "*.cvs"

Assumes of course the string length before the part name is known, in your
example 4 numbers and a space (could include that space before the part
name).

Regards,
Peter T



"AdmSteck" wrote in message
...
I'm building a custom file import macro to import csv files created by
another program. They are all saved with the file name format of
PartNumber~Machine.csv. I am trying to use the application.filesearch

object
to return all the files for a part. I also need to show both the right

and
left part numbers. Some example part numbers a

6562 Part 1 Right
6567 Part 1 Left
6561 Part 2 Right
6566 Part 2 Left
6081 Part 3 Right
6091 Part 3 Left
6061 Part 4 Right
6071 Part 4 Left

The problem is when I use wildcards in the .filename property of the
filesearch, it returns part 1 and 2, or 3 and 4. Is there any way to fix
this so it only shows both right and left of the part I want?





All times are GMT +1. The time now is 03:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com