+ Reply to Thread
Results 1 to 12 of 12

VBA to save pages as pdf

  1. #1
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    VBA to save pages as pdf

    Dear All,

    I found the below code for to

    Saveas ActiveSheet from page 1 to 1 at the location D:\SB TYRES\Excel\Day Sheets\

    with file name referencing to Range "B1"

    There is a date in B1 (like this format 17-02-2017).

    I want the file name as exact B1.

    It's not working and macro being stopped at the save as dialogue box. (and also showing the different location).

    Any help be appreciated.

    Thanks in advance.


    Similar Question has been asked in other forum. Click here to refer


    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by kprabhupaul; 02-18-2017 at 04:39 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: VBA to save pages as pdf

    Please post the code you are using here within code tags.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    Please find the edited post #1

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA to save pages as pdf

    Try this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    please add pages range

    I want from 1 to 1

  6. #6
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    I have added pages range in this line

    Please Login or Register  to view this content.
    and tried again.

    file name is taking same as B1. (it's ok)

    but still now macro is being not completed, and showing the location is also different
    Attached Images Attached Images

  7. #7
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    If it was able to show the correct location, I can hit enter then the file will be saved.

    But either (1) it is not completing the macro (2) nor showing the correct location ..

    please do the needful ..

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: VBA to save pages as pdf

    Please exercise some patience!!! When someone comes online who can help you, you will get some help. You do not need to keep bumping the thread.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA to save pages as pdf

    This works for me.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    yes, now the location is showing correctly ..

    but not completing the total work. stopping at save as dialogue box.

    No problem, I CAN HIT ENTER.

    thank You Bakerman2 [ADDED REPUTATION]

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA to save pages as pdf

    As the location is always the same and filename is always in B1 why use dialogue box at all?

    Please Login or Register  to view this content.
    BTW thanks for rep+.

  12. #12
    Forum Contributor
    Join Date
    06-02-2016
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    327

    Re: VBA to save pages as pdf

    omg!

    I tried your updated code.

    It's completing all the work very well.

    well done and thank you so much ..

+ 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. Save some pages as PDF
    By Shroeder in forum Excel Programming / VBA / Macros
    Replies: 40
    Last Post: 09-26-2016, 01:56 PM
  2. Save only certain pages in workbook template
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2015, 07:24 AM
  3. Save to .pdf over multiple pages?
    By JungleJme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 04:26 AM
  4. Extract pages from word file and save extracted pages to new word file
    By bonny24tycoon in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2012, 09:45 AM
  5. VBA to save URL pages
    By Mth1jdc2008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-29-2008, 01:14 PM
  6. [SOLVED] How to d/load & save web pages w/VBA?
    By Ron in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2006, 03:10 PM
  7. [SOLVED] How do you only save 4 pages of the workbook
    By Cathy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2005, 04:08 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