Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to open a PDF, print, then close - Stumped
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I like to open a folder,auto print,save then close | Excel Programming | |||
Open, print and close workbook | Excel Programming | |||
Open, print and close workbook | Excel Programming | |||
Open, print and close workbook | Excel Programming | |||
Open, print and close workbook | Excel Programming |