Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-25-2011, 12:58 AM
OTPM OTPM is offline vba Code to Print Spreadsheet to PDF Windows 7 32bit vba Code to Print Spreadsheet to PDF Office 2010 32bit
Expert
vba Code to Print Spreadsheet to PDF
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default vba Code to Print Spreadsheet to PDF

Hi
I am looking for a piece of vba code that I can use to automatically print an excel spreadsheet directly to a pdf file without user interaction. Can anyone help as I am struggling to create or find some.


Thanks in advance.
Tony
Reply With Quote
  #2  
Old 05-25-2011, 03:22 AM
Catalin.B Catalin.B is offline vba Code to Print Spreadsheet to PDF Windows Vista vba Code to Print Spreadsheet to PDF Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Hi Tony, maybe you can use this: ( you most have adobe acrobat installed, and the selected worksheets will be combined in a single PDF file!. If not, select only 1 sheet, and change your pdf printer adress):

Sub ImprimaPDF()
Sheets(Array("pagina 1 plan", "plan afaceri")).Select
Sheets("pagina 1 plan").Activate
Application.ActivePrinter = "Adobe PDF din Ne02:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF din Ne02:"",,TRUE,,FALSE)"
Sheets("plan afaceri").Select
End Sub
Reply With Quote
  #3  
Old 05-25-2011, 03:50 AM
Catalin.B Catalin.B is offline vba Code to Print Spreadsheet to PDF Windows Vista vba Code to Print Spreadsheet to PDF Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Or this, to print all selected sheets in 1 PDF file:
Sub ImprimaFoaieActivaPDF()
ActiveWindow.SelectedSheets.PrintOut
Application.ActivePrinter = "Adobe PDF din Ne02:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF din Ne02:"",,TRUE,,FALSE)"

End Sub
Reply With Quote
  #4  
Old 05-25-2011, 08:22 AM
OTPM OTPM is offline vba Code to Print Spreadsheet to PDF Windows 7 32bit vba Code to Print Spreadsheet to PDF Office 2010 32bit
Expert
vba Code to Print Spreadsheet to PDF
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi Catalin.B
Many many thanks, this is excellent.
Tony
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code to Print Individual Resource Lists to a pdf File OTPM Project 0 05-24-2011 12:21 PM
vba Code to Print Spreadsheet to PDF Creating a spreadsheet nickypatterson Excel 1 01-14-2010 03:21 PM
vba Code to Print Spreadsheet to PDF Looking for a specific spreadsheet DivideByZer0 Excel 3 11-10-2009 05:58 PM
vba Code to Print Spreadsheet to PDF Print preview and actual print do not match? anthrax19888 Word 1 10-12-2009 08:09 AM
vba Code to Print Spreadsheet to PDF Spreadsheet for words Rosie Office 3 06-15-2005 02:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:16 PM.


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