M
Marc T
Hi all,
I have the following code that opens a PDF and prints (as well as a cuople
of excel files). That part works perfectly, but how would I go about closing
the PDF after it prints?
Sub RunLoop()
Dim Folder As String
Dim FName As String
Dim bk As Workbook
Dim strPath As String
strPath = ThisWorkbook.Path
With Application.FileSearch
.SearchSubFolders = True
.LookIn = strPath
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) Like "*File 1*.xls" Then
Workbooks.Open .FoundFiles(i)
Call PrintMacro
ElseIf .FoundFiles(i) Like "*File 2*.xls" Then
Workbooks.Open .FoundFiles(i)
Call PrintMacro2
ElseIf .FoundFiles(i) Like "*File 4*.pdf" Then
ActiveWorkbook.FollowHyperlink .FoundFiles(i), NewWindow:=True
Application.SendKeys "^p~", False
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
thanks as ever!
Marc
I have the following code that opens a PDF and prints (as well as a cuople
of excel files). That part works perfectly, but how would I go about closing
the PDF after it prints?
Sub RunLoop()
Dim Folder As String
Dim FName As String
Dim bk As Workbook
Dim strPath As String
strPath = ThisWorkbook.Path
With Application.FileSearch
.SearchSubFolders = True
.LookIn = strPath
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) Like "*File 1*.xls" Then
Workbooks.Open .FoundFiles(i)
Call PrintMacro
ElseIf .FoundFiles(i) Like "*File 2*.xls" Then
Workbooks.Open .FoundFiles(i)
Call PrintMacro2
ElseIf .FoundFiles(i) Like "*File 4*.pdf" Then
ActiveWorkbook.FollowHyperlink .FoundFiles(i), NewWindow:=True
Application.SendKeys "^p~", False
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
thanks as ever!
Marc