Results 1 to 2 of 2

Thread: application.filesearch & multiple conditions

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    1

    application.filesearch & multiple conditions

    Hello.
    First, please forgive me my english.
    Whole morning till now I'm sitting and trying find solution for my problem. Please look code for MSWord 2003 makro
    Code:
    Sub szukacz()
        Selection.WholeStory
        Selection.Delete Unit:=wdCharacter, Count:=1
    HR600")
    Set fs = Application.FileSearch
    With fs
        .LookIn = "C:\Szukacz" 
        .SearchSubFolders = True
        .FileName = "*.txt"
     With fs.PropertyTests
        .Add "Text or property", _
            msoConditionIncludes, "D5JFP", msoConnectorAnd
        .Add "Text or property", _
            msoConditionIncludes, "23158", msoConnectorAnd
    End With
      If .Execute > 0 Then
            For i = 1 To .FoundFiles.Count
                tekst = .FoundFiles(i)
                pierw_bksl_od_kon = InStrRev(tekst, "\")
                drugi_bksl_od_kon = InStrRev(tekst, "\", pierw_bksl_od_kon - 1)
                poz_kropki = InStrRev(tekst, ".")
                nazwa_fold = Mid(tekst, drugi_bksl_od_kon + 1, pierw_bksl_od_kon - drugi_bksl_od_kon - 1)
                nazwa_plku = Dir(.FoundFiles(i))
                link_do_podgladu = "https://latis2.deltamarin.com/kronodoc/4441/Get/" & nazwa_fold & "/" & nazwa_plku
                link_do_edycji = "https://latis2.deltamarin.com/kronodoc?project=4441&root=77399&currdir=82996&selecteddocs=" _
                & nazwa_fold & "&selfile=" & nazwa_plku & "&action=Insert+text"
            
            Selection.TypeText Text:=nazwa_plku & " "
            ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
            link_do_podgladu, SubAddress:="", ScreenTip:="", TextToDisplay:="Podgląd"
            Selection.TypeText Text:=" "
            ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
            link_do_edycji, SubAddress:="", ScreenTip:="", TextToDisplay:="Edycja"
            Selection.TypeText Text:=Chr(13)
    
            Next i
        Else
            MsgBox "Nie znaleziono panelu spełniającego zadane kryteria"
        End If
    End With
    End Sub
    Code work but doesn't find any file. For shore there is file with searching content.
    I've tried for .Add "Text or property" also "File content" and "Contents".
    Please keep in mind, that I'm totally beginner in VBA.
    Hope you will find solution quickly.
    Regards

    MW

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: application.filesearch & multiple conditions

    Thread moved from 'VB6' forum to the 'Office Development/VBA' forum (while VBA and VB6 have some similarities, they are not the same thing)

Posting Permissions

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



Click Here to Expand Forum to Full Width