How to export only page 1 as PDF

Melimob

Active Member
Joined
Oct 16, 2011
Messages
395
Office Version
  1. 365
Hi there

I have the below code which works perfectly however I want to only export/save page 1 of the PDF not page 2.
Can anyone please tell me how I can incorporate this in to the below code?:

Code:
Sub emailsavePDF_weekly()


Dim objOutlook As Object
    Dim objMail As Object
    Dim signature As String
    Dim oWB As Workbook
    Set oWB = ActiveWorkbook
    Dim PDF_File As String
    
    
    
     s = Range("b1").Value
  
  
 '
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
         s, Quality:=xlQualityStandard, IncludeDocProperties _
         :=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
         
         
    PDF_File = Range("b1").Value
 
    
    Set objOutlook = CreateObject("Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)
        
    With objMail
        .display
    End With
        signature = objMail.body
    With objMail
        .To = Range("A1").Value
        .Cc = "test@test.co.uk"
        .Subject = "Weekly League Tables for Banked vs Written " & Range("e8").Value
      
        .body = "Dear All" _
                      & vbNewLine & vbNewLine & _
                      "Please find attached this weeks' league tables." _
                      & vbNewLine & vbNewLine _
                      & "Any questions please do not hesitate to ask." _
                      & vbNewLine & vbNewLine _
                      & "Kind Regards," _
                      & vbNewLine _
                      & "Lindsay" _
                      & vbNewLine _
                      & signature
        .Attachments.Add PDF_File
        .Save
        .display
    End With
    '_




    Set objOutlook = Nothing
    Set objMail = Nothing
End Sub
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
.
This should do it :

Code:
Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
         s, Quality:=xlQualityStandard, IncludeDocProperties _
         :=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
 
Upvote 0
Hi,
Just use additional parameters From:=1, To:=1 as follows:
Rich (BB code):
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=s, _
         Quality:=xlQualityStandard, IncludeDocProperties:=True, _
         From:=1, To:=1, _
         IgnorePrintAreas:=False, OpenAfterPublish:=False
 
Upvote 0
Hi,
Just use additional parameters From:=1, To:=1 as follows:
Rich (BB code):
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=s, _
         Quality:=xlQualityStandard, IncludeDocProperties:=True, _
         From:=1, To:=1, _
         IgnorePrintAreas:=False, OpenAfterPublish:=False

Perfect thank you both for your replies.

KR
 
Upvote 0

Forum statistics

Threads
1,214,542
Messages
6,120,116
Members
448,945
Latest member
Vmanchoppy

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