+ Reply to Thread
Results 1 to 5 of 5

Find files in a directory using excel VBA

  1. #1
    Registered User
    Join Date
    10-29-2007
    Posts
    3

    Find files in a directory using excel VBA

    Hello!

    I need to find some files in a directory and copy them to x folder using a VBA excel, this is possivel??

    For example;

    Find files that they contain xyz on is filename and for each find copy them to x folder

    Thanks for your help

    Júlio

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Try to use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    10-29-2007
    Posts
    3
    Quote Originally Posted by antoka05
    Try to use this code:
    Please Login or Register  to view this content.



    Regards,
    Antonio

    Obrigado amigo António

    Posso pôr a questão de um ponto de vista mais prático, sou mesmo leigo nestas coisas;

    A pesquisa que pretendo é multipla, isto é, tenho uma série de dados no meu sistema central (AS/400) que me identificam parcialmente o nome do ficheiro (no caso PDF) que tenho armazenado em rede numa dada directoria, e pretendia o seguinte:

    Exportava para um ficheiro excel os identificadores desses ficheiros :
    P.E. na celula A1 com 05780-02;05788-02;05683-02, de que forma ajustaria a macro para pesquisar os pdf`s cujo nome contivesse algum destes 3 valores?

    Como comporia a string (de certeza não será com o ; como separador de valores) para mais facilmente ser lida pela macro?

    Tambem é fácil para mim exportar linha a linha os valores a procurar se dessa forma simplificar o código da macro;

    05780-02
    05788-02
    05683-02
    ..
    ..
    ..

    Um abraço

    Júlio

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    You can leave A1 cell as is now, with ';' separator and try to use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  5. #5
    Registered User
    Join Date
    10-29-2007
    Posts
    3
    Thanks António

    Sorry I wrote my last post in portuguese because I thought you were from portugal (just like me).

    Thanks a lot, your aid was very precious

    One question more;
    In the mainFolder and subfolders there are lots of files (more than 5000) to search, and the routine is very slow, you know one way to the process become faster?

    Best Regards;

    Júlio Mendes
    Last edited by julioMendes1964; 10-30-2007 at 12:32 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1