As stated, I cannot figure out how to print off PDF files using VBA.
I have a code that opens a folder and then is supposed to print off all pdf files in that folder.
Can anyone help me out?
Sub PDFPrint()
Dim myShell As Object
Set myShell = CreateObject("WScript.Shell")
Dim wb As Workbook
Dim ws As Worksheet
Dim strF As String, strP As String
Dim strFP As String
Range("A2:A10000").ClearContents
Set ws = ThisWorkbook.Sheets(1)
strFP = Cells(1, 4).Value
strP = "P:\17. PPI Packs\1. RBSO001 - RBS\" & strFP
strF = Dir(strP & "\*.pdf")
Do While strF <> vbNullString
With ws
If .Range("A1").End(xlDown).Row = 1048576 Then
.Range("A2").Value = strF
Else
.Range("A" & Rows.Count).End(xlUp).Offset(1).Value = strF
End If
End With
strF = Dir()
Loop
End Sub
[COLOR=#333333]Option Explicit[/COLOR]
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ByVal hwnd As Long, _ByVal lpOperation As String, _ByVal lpFile As String, _ByVal lpParameters As String, _ByVal lpDirectory As String, _ByVal nShowCmd As Long) As Long </pre>[COLOR=#333333][/COLOR]
Compile Error:
The code in this project must be updated for use on 64 bit systems.
Please review and update Declare statements and then mark them with
the PtrSafe attribute.
BriangG - please stick to one thread. Duplicates will be deleted. You'll get more help if you respond to the questions the people trying to help you are asking.