+ Reply to Thread
Results 1 to 2 of 2

Help how to limit the number pages VBA converts excel into PDF

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Help how to limit the number pages VBA converts excel into PDF

    I have a sheet I am using VBA to convert an excel sheet into PDF and attach it to outlook. If I take the same sheet and manually create a PDF it is only ten pages the amount of pages the excel files has values in.
    When the VBA does it the PDF file is 45 pages long.

    How can I limit the PDF pages or get it to only create PDF of cells with values in it. Here is the code.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Help how to limit the number pages VBA converts excel into PDF

    Without seeing the data, I don't know. Have you checked your PrintArea(s)? e.g.
    Please Login or Register  to view this content.
    Maybe record a macro and compare to your manual code?

    I do have some suggestions otherwise.

    1. Use Sheet's Protect with UserInterfaceOnly:=True rather than Protect and UnProtect. I normally do that for all sheets in the ThisWorkbook's Open event.
    2. Seldom is Activate and ActiveWindow needed.
    3. Change the Copy to just the UsedRange. Normally, Column A should never have blanks for data. The first blank should be the end of the data for all rows. Of course not knowing your data, that can change. Coupled with (2), you could turn 5 or 6 lines into one long line.

    If you want to try any of the suggestions and need help, please post back. Always test on backup copy. e.g. Some of the suggestions, do not run unless you understand each part.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 12
    Last Post: 01-26-2016, 08:33 PM
  2. Number converts in Excel
    By matija_sikic in forum Excel General
    Replies: 1
    Last Post: 07-22-2013, 09:56 AM
  3. Limit Excel Sheet to 1 Page (Eliminate additional pages)
    By gdwntheresa in forum Excel General
    Replies: 3
    Last Post: 01-02-2013, 09:52 PM
  4. Entering a number that converts to text
    By andrewmcnabb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2012, 07:52 AM
  5. Excel converts formula to number
    By noyb in forum Excel - New Users/Basics
    Replies: 11
    Last Post: 06-22-2006, 11:45 AM
  6. Whole number converts to decimal
    By dmbRedGetta in forum Excel General
    Replies: 1
    Last Post: 09-18-2005, 02:05 PM
  7. Using Excel converts number to english text
    By Lionel Lim (Malaysia) in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-22-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1