你能帮我吗,请用磁盘上的搜索文件创建一个宏,
看看:C:\Etikety\Stitky\
。
我搜索包含在单元格C2
中的名称
和文件类型为.lbe
找到文件后打印出来。
我会将这部分代码实现到这段代码中。感谢回复
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
答案 0 :(得分:1)
根据需要编辑并尝试使用以下代码:
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