PDF Export Issue

Lee Rabbit

New Member
Joined
Apr 30, 2020
Messages
43
Office Version
  1. 2010
Platform
  1. Windows
Hi all, please see code below. Has been working fine for a long time but now issues.

When I export I am seeing my PDF as 3 separate pages instead of the data being exported to a single page.

Any ideas why this may be happening? Thanks in advance

VBA Code:
Sub emailPDF_Sunday()

    Range("B3:B58").Select
    Selection.Copy
    Range("B70").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    
    Range("C3:D58").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("C70").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False

    With ActiveSheet.PageSetup
       .Orientation = xlPortrait
       .PrintArea = ("$B$70:$D$130")
       .Zoom = False
       .FitToPagesTall = 1
       .FitToPagesWide = 1
    End With
      
    Application.ScreenUpdating = False
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            filename:="C:\PDF\" & Range("B3").Value & " " & Range("D3").Value
    Application.ScreenUpdating = True

         
    MsgBox "PDF HAS BEEN SAVED", vbExclamation
       
 
  Call RowsDelete
  Range("A1").Select
  
 
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi all, please see code below. Has been working fine for a long time but now issues.

When I export I am seeing my PDF as 3 separate pages instead of the data being exported to a single page.

Any ideas why this may be happening? Thanks in advance

VBA Code:
Sub emailPDF_Sunday()

    Range("B3:B58").Select
    Selection.Copy
    Range("B70").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
   
    Range("C3:D58").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("C70").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False

    With ActiveSheet.PageSetup
       .Orientation = xlPortrait
       .PrintArea = ("$B$70:$D$130")
       .Zoom = False
       .FitToPagesTall = 1
       .FitToPagesWide = 1
    End With
     
    Application.ScreenUpdating = False
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            filename:="C:\PDF\" & Range("B3").Value & " " & Range("D3").Value
    Application.ScreenUpdating = True

        
    MsgBox "PDF HAS BEEN SAVED", vbExclamation
      
 
  Call RowsDelete
  Range("A1").Select
 
 
End Sub

No worries, problem solved
 
Upvote 0
Glad to hear you got the solution.

If you would like to post your solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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