Preint Preview code

ManvinderKaur

Board Regular
Joined
Jun 16, 2010
Messages
149
Hi I am using following code for print preview of spreadsheet.

'command button to print site survey water worksheet
Private Sub cmdPrintSiteSurveyWater_Click()
On Error GoTo ErrorLine
Dim SiteSurveyWater As Integer
' message box to prompt print out
SiteSurveyWater = MsgBox("Do you want to take print out of Site Survey Water Sheet", vbYesNo + vbInformation, "Print Out")
If SiteSurveyWater = vbYes Then

With Worksheets("3.1 Site Survey Water Print")
.Visible = True
.Activate

With Worksheets("3.1 Site Survey Water Print").PageSetup

.PrintTitleRows = "$1:$3"
.PrintTitleColumns = ""
.PrintArea = "$A$1:$I$37"
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "Page &P"
.CenterFooter = ""
.RightFooter = "&T &D"
.LeftMargin = Application.InchesToPoints(0.26)
.RightMargin = Application.InchesToPoints(0.26)
.TopMargin = Application.InchesToPoints(0.4)
.BottomMargin = Application.InchesToPoints(0.4)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.Zoom = 77

End With

.PrintPreview

End With
End If
Exit Sub
ErrorLine:
MsgBox ("Error Number:" & Err.Number & ". " & Err.Description & ". Source:" & Err.Source)
ActiveWorkbook.Close
End Sub


it is very slow... take 30 sec to display print preview....how come I modify this?...
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
This code renews print setup each time it runs. Do you really want to do that? If you set the print setup then do a preview it should work without the need to rerun the setup each time.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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