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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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
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
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
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,214,918
Messages
6,122,252
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