karelbek1967
Gebruiker
- Lid geworden
- 9 mrt 2014
- Berichten
- 58
Hallo,
Onderstaande macro werkt perfect om een pdf-bestand te printen.
Alleen wil ik er iets in hebben verwerkt dat ervoor zorgt dat de huidige pagina (altijd pagina 1) wordt geprint van het pdf-bestand.
Heeft iemand daarvoor de code?
Gr. Karel
Onderstaande macro werkt perfect om een pdf-bestand te printen.
Alleen wil ik er iets in hebben verwerkt dat ervoor zorgt dat de huidige pagina (altijd pagina 1) wordt geprint van het pdf-bestand.
Heeft iemand daarvoor de code?
Code:
Option Explicit
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
Public Function PrintThisDoc(formname As Long, FileName As String)
On Error Resume Next
Dim X As Long
X = ShellExecute(formname, "Print", FileName, 0&, 0&, 3)
End Function
Sub testPrint()
Dim printThis
Dim strDir As String
Dim strFile As String
strDir = "C:\Test"
strFile = "test123.pdf"
printThis = PrintThisDoc(0, strDir & "\" & strFile)
strFile = "test123.pdf"
printThis = PrintThisDoc(0, strDir & "\" & strFile)
End Sub
Gr. Karel
Laatst bewerkt door een moderator: