-1

Can you help me please creating a macro with search file from disk, look in: C:\Etikety\Stitky\. I search a name which contain in cell C2 and file type is .lbe
When file found print it. I would implemate this part of code into this code. Thank for reply


Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub zadat()

Dim reg, check As String
Dim i, j, done As Integer
reg = Cells(2, 3).Value
check = Cells(4, 3).Value

If check = "True" Then

    i = 2
    j = 1
    done = 0
    Do While Sheets("data").Cells(i, j) <> ""
        If Sheets("data").Cells(i, j) = reg Then
            done = Sheets("data").Cells(i, j + 3)
            done = done + 1
            Sheets("data").Cells(i, j + 3) = done
            Exit Do
        End If
        i = i + 1

    Loop
Else
    MsgBox ("Chyba, oprav!!!")
End If

Cells(3, 3) = ""

Cells(3, 3).Select
ActiveWindow.ScrollRow = Cells(1, 1).row

End Sub
vacip
  • 5,246
  • 2
  • 26
  • 54
Fiínek Cahů
  • 67
  • 1
  • 2
  • 11
  • http://stackoverflow.com/questions/20687810/vba-macro-that-search-for-file-in-multiple-subfolders – Slai Jul 26 '16 at 10:03

1 Answers1

1

Edit and try following code as per your need:

Sub find_N_print()
    Dim filePath As String
    filePath = "C:\Etikety\Stitky\" & Range("C2").Value & ".lbe"
    file = Dir(filePath)
    If file <> "" Then
        Application.PrintOut Filename:=filePath & file
    End If
End Sub
J.B.
  • 445
  • 1
  • 4
  • 8