Excel sheet to PDF

rockchalk33

Board Regular
Joined
Jan 12, 2016
Messages
111
Hey all,

Need a little help writing a macro to:

1.) Fit all columns on one page
2.) Open that specific page (specifically Sheets("Sheet5")) in a PDF file with all columns on that page

Thanks,

Devin
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Trustee

New Member
Joined
Nov 23, 2016
Messages
16
Hi there,

Please follow the steeps:


  • Click the Page Layout tab;
  • Go to the Page Setup group;
  • Click the arrow button at the bottom right corner;
  • Then you will enter the page tab of Page Setup dialog box.
  • Then File ----> Save as ----> Format ----> PDF.

Hope this will help you !
 
Upvote 0

rockchalk33

Board Regular
Joined
Jan 12, 2016
Messages
111
Hi there,

Please follow the steeps:


  • Click the Page Layout tab;
  • Go to the Page Setup group;
  • Click the arrow button at the bottom right corner;
  • Then you will enter the page tab of Page Setup dialog box.
  • Then File ----> Save as ----> Format ----> PDF.

Hope this will help you !

Appreciate the help but I actually need a sub routine to do this.
 
Upvote 0

Kenneth Hobson

Well-known Member
Joined
Feb 6, 2007
Messages
3,181
Office Version
  1. 365
Platform
  1. Windows
There are too many setting to show all of them. Record a macro and do the steps explained in #2.

Then do something like this and modify to suit your options.
Code:
Sub Main()
  Dim fn$
  fn = Environ("temp") & "\Rock.pdf"
  With Sheets("Sheet5")
    .PageSetup.PrintArea = .UsedRange.Address
    With .PageSetup
      
      .Orientation = xlLandscape
      .FitToPagesWide = 1
      .FitToPagesTall = False
    End With
    .ExportAsFixedFormat xlTypePDF, fn, OpenAfterPublish:=True
  End With
End Sub
 
Upvote 0

rockchalk33

Board Regular
Joined
Jan 12, 2016
Messages
111
There are too many setting to show all of them. Record a macro and do the steps explained in #2.

Then do something like this and modify to suit your options.
Code:
Sub Main()
  Dim fn$
  fn = Environ("temp") & "\Rock.pdf"
  With Sheets("Sheet5")
    .PageSetup.PrintArea = .UsedRange.Address
    With .PageSetup
      
      .Orientation = xlLandscape
      .FitToPagesWide = 1
      .FitToPagesTall = False
    End With
    .ExportAsFixedFormat xlTypePDF, fn, OpenAfterPublish:=True
  End With
End Sub

Thanks!
 
Upvote 0

Forum statistics

Threads
1,191,001
Messages
5,984,091
Members
439,872
Latest member
noaman79

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
Top