Table of Contents
Print Preview in VBA allows users to view a document or report before printing it, giving them the opportunity to make any necessary changes or adjustments. This feature can be especially useful for creating professional and error-free documents. Some examples of its use include checking for formatting issues, ensuring all necessary information is included, and adjusting page margins or layout. Additionally, Print Preview can be used to create a more organized and visually appealing final product. By utilizing this feature in VBA, users can save time and improve the overall quality of their printed materials.
Use Print Preview in VBA (With Examples)
You can use the following methods in VBA to display a print preview before actually printing a sheet:
Method 1: Print Preview for Entire Sheet
Sub UsePrintPreview()
ActiveSheet.PrintPreview
End Sub
This particular macro will provide a print preview for the entire currently active sheet.
Method 2: Print Preview for Selected Area
Sub UsePrintPreview()
Selection.PrintPreview
End SubThis particular macro will provide a print preview for only the currently selected area of the sheet.
The following examples show how to use each method with the following active sheet in Excel:

Example 1: Print Preview for Entire Sheet
Suppose we would like to print the entire active sheet.
We can create the following macro to perform a print preview to see what the printed page will look like before we actually print it:
Sub UsePrintPreview()
ActiveSheet.PrintPreview
End SubWhen we run this macro, the following print preview window appears:

This shows us exactly what the page will look like if we print the entire currently active sheet.
Example 2: Print Preview for Selected Area
We can create the following macro to perform a print preview to see what this selected area will look like on a page before we actually print it:
Sub UsePrintPreview()
Selection.PrintPreview
End SubWhen we run this macro, the following print preview window appears:

This shows us exactly what the page will look like if we print only the selected area.
Note: You can find the complete documentation for the PrintPreview method in VBA .
Cite this article
stats writer (2024). How can I utilize Print Preview in VBA, and what are some examples of its use?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-utilize-print-preview-in-vba-and-what-are-some-examples-of-its-use/
stats writer. "How can I utilize Print Preview in VBA, and what are some examples of its use?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-utilize-print-preview-in-vba-and-what-are-some-examples-of-its-use/.
stats writer. "How can I utilize Print Preview in VBA, and what are some examples of its use?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-utilize-print-preview-in-vba-and-what-are-some-examples-of-its-use/.
stats writer (2024) 'How can I utilize Print Preview in VBA, and what are some examples of its use?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-utilize-print-preview-in-vba-and-what-are-some-examples-of-its-use/.
[1] stats writer, "How can I utilize Print Preview in VBA, and what are some examples of its use?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I utilize Print Preview in VBA, and what are some examples of its use?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
