Consulting

Results 1 to 2 of 2

Thread: Office 2003 To office 2007 macros (FileSearch)

  1. #1
    VBAX Newbie
    Joined
    Jun 2012
    Posts
    1
    Location

    Office 2003 To office 2007 macros (FileSearch)

    Hello,

    I'm working with the Office 2007 now, but I'm with macros that is not working because, this macros use the command "Application.FileSearch".

    How can I change my code for the Office 2007.

    I want to change but I don't know how can I do that.

    Function Executa_Tudo(ARQUIVO, NomeArquivo)
    Dim Endereco As String
    Dim i, u As Integer
    Dim pasta As String
    Dim Existe_Campo1, Existe_Campo2, Existe_Campo3 As Variant
    ' Declaração das classes
    Dim Canaletafront As New CCanaleta_Front
    Dim canaletaRear As New CCanaleta_rear
    Dim CanaletaLOP As New CCanaletaLOP
    Dim CanaletaLP As New CCanaletaLP
    Dim Crown As New CCrown
    Dim FPPRear As New CFPP_rear
    Dim FPVRear As New CFPV_Rear
    Dim front As New CFront
    Dim Rear As New CLado_rear
    Dim LadoPressao As New CLadoPressao
    Dim LOP As New CLOP
    Dim Pinos As New CPinos
    Dim Undercrown As New CUnderCrown
    Dim fotos As Tfotos
    Dim a, b, c, d, e, f, g, h, m, j, k, l As Variant
    Novo_Endereço:
    Endereco = BrowseDialog(0, "Selecione o endereço das fotos a serem inseridas")

    If (Endereco <> "") Then
    With Application.FileSearch
    .FileName = "*.jpg"
    .LookIn = Endereco
    .SearchSubFolders = False
    .Execute
    If (.FoundFiles.Count > 0) Then
    For i = 1 To .FoundFiles.Count
    NomeArquivo = Dir(Application.FileSearch.FoundFiles(i))

    Existe_Campo1 = Switch(NomeArquivo = "Pistão1_Topo.JPG", 10, NomeArquivo = "Pistão3_Topo.JPG", 28, _
    NomeArquivo = "Pistão5_Topo.JPG", 46, NomeArquivo = "Pistão1_Boca.JPG", 64, NomeArquivo = "Pistão3_Boca.JPG", _
    82, NomeArquivo = "Pistão5_Boca.JPG", 100, NomeArquivo = "Pistão1_L.P..JPG", 118, NomeArquivo = _
    "Pistão3_L.P..JPG", 136, NomeArquivo = "Pistão5_L.P..JPG", 154, NomeArquivo = "Pistão1_L.O.P..JPG", 172, _
    NomeArquivo = "Pistão3_L.O.P..JPG", 190, NomeArquivo = "Pistão5_L.O.P..JPG", 208, _


    THANK YOU.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    FileSearch was removed in 2007.

    You will need to rewrite using another method (which will probably also work in 2003)

    Example File system object mthod

    http://support.microsoft.com/kb/185601/
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

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