Can creating pdf BVA be faster?

karolina1406

Board Regular
Joined
Apr 18, 2016
Messages
110
Office Version
  1. 365
Platform
  1. Windows
hi, I am using below code for creating pdf from my excel file but it is extremely slow and often freezes the workbook... any ideas how i can improve it?
VBA Code:
Private Sub CommandButton1_Click()
'populating Customer Handover certificate in Excel
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("loa")

sh.Range("b7").Value = "RE: Letter of Authority for Access at:"
sh.Range("c9").Value = Address.Text
sh.Range("c12").Value = LLUC.Text
sh.Range("c13").Value = Floor.Text
sh.Range("c14").Value = Suite.Text
sh.Range("c15").Value = Rack.Text
sh.Range("c16").Value = "First available"
sh.Range("c17").Value = Connector.Text
sh.Range("c18").Value = NoofConnections.Text



    With Sheets("loa").PageSetup
    .PrintTitleRows = ""
    .PrintTitleColumns = ""
    .LeftMargin = Application.CentimetersToPoints(1.5)
    .RightMargin = Application.CentimetersToPoints(0.5)
    .TopMargin = Application.CentimetersToPoints(0.5)
    .BottomMargin = Application.CentimetersToPoints(0.5)
    .HeaderMargin = Application.CentimetersToPoints(0.2)
    .FooterMargin = Application.CentimetersToPoints(0.2)
    .PaperSize = xlPaperA4
    .Orientation = xlPortrait
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1

End With

Me.OrderNumberTX.Value = ""
Me.Address.Value = ""
Me.LLUC.Value = ""
Me.Floor.Value = ""
Me.Suite.Value = ""
Me.Rack.Value = ""
Me.Connector.Value = ""
Me.NoofConnections.Value = ""

LOA.Hide

Sheets("loa").PageSetup.PrintArea = ""
Sheets("loa").PageSetup.PrintArea = "$b$1:$d$34"
Worksheets("loa").PrintPreview


Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.EnableEvents = True

End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,605
Messages
6,120,476
Members
448,967
Latest member
visheshkotha

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