+ Reply to Thread
Results 1 to 17 of 17

Print/Saving a perticular sheet as PDF

  1. #1
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Print/Saving a perticular sheet as PDF

    Hi all..

    I have a workbook with 3 sheets. On sheet 1 I have macro buttons 1 of which "prints/saves as pdf" the current/active sheet. I would like to add a button which "prints/saves as pdf" sheet 2. How is this possible please?

    Thanks

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    Sure, can you post the code you have so far.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Im sorry... Here it is
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    It would be like this:

    Please Login or Register  to view this content.

    Dom

  5. #5
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Fandabby dozy - thank you.

  6. #6
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    I dont suppose you know how to specify a file name for it to save as? Not a file location just file name? Thanks

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    Can't test this but maybe:

    Please Login or Register  to view this content.

    Dom

  8. #8
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Thanks for trying, unfortunatly it still saves the pdf as the original workbook name

  9. #9
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    Odd I thought that would work. I assume you've saved the workbook before running the code?

    Dom

  10. #10
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Yeah I saved it, even closed it down and then reopend it. The code is as below:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    Nearly, I'd called the variable strFileName:

    Please Login or Register  to view this content.

    Dom

  12. #12
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Ah ha!! Cool that works fine... Thanks..

    I notice you can name the pdf based on a cell content, is it possible to append a cell field infront of the "\test1.pdf" so it would read "\test1-cellcontent.pdf"?

    Thanks

  13. #13
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    Like this:

    Please Login or Register  to view this content.

    Dom

  14. #14
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Exactly like that only it didnt work, Ive got my str's in place this time

    Please Login or Register  to view this content.

  15. #15
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    It will be picking the cell info up from cell A1 on the active worksheet. Is this how you have it set up?

    Dom

  16. #16
    Registered User
    Join Date
    12-07-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Print/Saving a perticular sheet as PDF

    Excuse my utter stupidity I accidently labled the cell with nothing in it - doh. Works perfectly thanks

  17. #17
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Print/Saving a perticular sheet as PDF

    No worries. Please mark the thread Solved if you're happy with the solution.

    Dom

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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