Print Preview through command button/Shape

azad092

Board Regular
Joined
Dec 31, 2019
Messages
198
Office Version
  1. 2007
Platform
  1. Windows
Hi
i have a data entry sheet including an interface sheet. on the interface sheet, I want to see the print preview for each sheet through clicking on the button/shape name for example
by clicking on Shape 1>> I want to see the sheet1 print preview
by clicking on Shape 2>> I want to see the sheet2 print preview
by clicking on Shape 3>> I want to see the sheet3 print preview
and so on....
Please guide me what I have to do
shapes.jpeg
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi azad092. You can see the Print Preview for Sheet1 by: ThisWorkbook.Worksheets("Sheet1").PrintPreview

Have you already put buttons on the interface worksheet, or do you need to know how to do that?

(Also, "Emergencies" starts with an "E".)
 
Upvote 0
Hi azad092. You can see the Print Preview for Sheet1 by: ThisWorkbook.Worksheets("Sheet1").PrintPreview

Have you already put buttons on the interface worksheet, or do you need to know how to do that?

(Also, "Emergencies" starts with an "E".)
thanks for reply... i try it
 
Upvote 0
If you create a macro for the Sheet1 preview like so (placing it in a normal module):

VBA Code:
Sub PPSheet1()
    ThisWorkbook.Worksheets("Sheet1").PrintPreview
End Sub

then you can right-click the shape for the Sheet1 print preview on your worksheet, select "Assign Macro", then choose "PPSheet1" as the macro. After doing that, if you click somewhere on the worksheet, then click the shape, you will see the print preview.
 
Upvote 0
If you create a macro for the Sheet1 preview like so (placing it in a normal module):

VBA Code:
Sub PPSheet1()
    ThisWorkbook.Worksheets("Sheet1").PrintPreview
End Sub

then you can right-click the shape for the Sheet1 print preview on your worksheet, select "Assign Macro", then choose "PPSheet1" as the macro. After doing that, if you click somewhere on the worksheet, then click the shape, you will see the print preview.
thanks a lot ....
 
Upvote 0
Glad to help.
hi
dear i am also facing a problem when i am using the following code
Private Sub Label1_Click()
ThisWorkbook.Worksheets("G Report").PrintPreview
rpftForm Unload
End Sub
the problem is that the userform also displayed in the print preview window and could not be closed. i want that when I click on the label to show the print preview the userform should be unload
 
Upvote 0
the problem is that the userform also displayed in the print preview window and could not be closed. i want that when I click on the label to show the print preview the userform should be unload

Are you calling the PrintPreview Macro from a Label on a UserForm ?
 
Upvote 0

Forum statistics

Threads
1,214,411
Messages
6,119,360
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top