+ Reply to Thread
Results 1 to 3 of 3

VBA for print to pdf

  1. #1
    Registered User
    Join Date
    04-01-2016
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    56

    VBA for print to pdf

    Strangely I actually found this exact question posted on another forum, but the solution didn't work for me.

    All I need to do is write some code to print/open a worksheet as a pdf, but NOT to save it - the file will be used by different people on different machines/networks, so the filepath would just cause an error (and I want users to decide for themselves whether to save the report). I recorded a macro and it works with a save. If I remove the filename bit, I get an error saying "not saved" or something.

    This is the macro I recorded:

    Please Login or Register  to view this content.
    Can anyone please tell me how I can remedy this and just open a sheet as a pdf, without saving? Thank you.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: VBA for print to pdf

    Short story: you can't do what you're trying to do. You can't open a worksheet as a pdf but you can save it.

    If the issue is the location where it will be saved, you can use a dialogue box to determine the location: http://www.ozgrid.com/VBA/ExcelsDialogBoxes.htm
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: VBA for print to pdf

    Thanks for the rep.

+ 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: 2
    Last Post: 08-29-2016, 01:36 PM
  2. Disabled print toolbar and menu but Print Macro button cannot print also...
    By zein97 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2014, 01:42 PM
  3. Set print area of selected range then print preview if ok then print the document!
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 07:10 AM
  4. Print Macro errors on final print command. Run-time error '1004':
    By Steverizer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 06:41 PM
  5. [SOLVED] Print array code for a series of pages that will also determine print area required?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2012, 11:46 PM
  6. VBA to set print range, open box asking for print qty, print, then redefine print area
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:43 PM
  7. Replies: 4
    Last Post: 02-17-2006, 08:36 AM

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