Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-22-2021, 03:35 PM
PhilTilson PhilTilson is offline Correct syntax for printing from VBA Windows 10 Correct syntax for printing from VBA Office 2016
Novice
Correct syntax for printing from VBA
 
Join Date: Nov 2021
Posts: 4
PhilTilson is on a distinguished road
Default Correct syntax for printing from VBA

Could somebody (Graham?) please tell me where I am going wrong with the syntax in this snippet:



Code:
    curPtr$ = Application.ActivePrinter
    Application.ActivePrinter = "Microsoft Print to PDF"
    ActiveDocument.PrintOut False, False, 0, txtFilename, 0, 0, 0, 1, 0, 0, True
    Application.ActivePrinter = curPtr$
The intention is clearly to print the whole of the current document to a .pdf file, given the name in txtFilename, but I just get a 'type mismatch' error on the third line.

Phil
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct syntax for printing from VBA Correct syntax for PtrSafe Function AccessibleObjectFromWindow Paul Cain Excel Programming 2 11-19-2018 04:29 AM
How do I ensure correct duplex printing? JCF Word 3 07-14-2017 06:55 AM
Correct syntax for printing from VBA VLookup Syntax ketbdnetbp Excel 2 04-12-2014 03:18 PM
Correct syntax for printing from VBA Can't seem to get the correct syntax for Wine list mailmerge daym Mail Merge 3 05-02-2011 03:26 AM
Correct syntax for printing from VBA Syntax help needed blazzercat Excel 3 07-09-2009 02:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft