Method prints specific range, print area, sheet or entire Excel workbook based on expression attached to PrintOut method. Let’s put some VBA code to examine various ways to Print.
Set a Print Area and give name to it by default Excel adds print area name as “PrintArea“. A sheet can have only one Print Area which can be verified under Name Manager.
Public Function PrintPrintAreaExample(oPrintAreaName As String) As Boolean PrintPrintAreaExample = False Worksheets(oSheetName).Range(oPrintAreaName).PrintOut PrintPrintAreaExample = True End Function
Public Function PrintSheetExample(oSheetName As String) As Boolean PrintSheetExample = False Worksheets(oSheetName).PrintOut PrintSheetExample = True End Function
Public Function PrintRangeExample(oPrintRange As Range) As Boolean PrintRangeExample = False oPrintRange.PrintOut PrintRangeExample = True End Function
Public Function PrintWorkbookExample(oWorkbook As Workbook) As Boolean PrintWorkbookExample = False oWorkbook.PrintOut PrintWorkbookExample = True End Function
Please leave your comments or queries under comment section also please do subscribe to our blogs to keep your self upto date.