+ Reply to Thread
Results 1 to 3 of 3

Save Active sheet as .pdf - file error

  1. #1
    Registered User
    Join Date
    03-23-2017
    Location
    Southampton, England
    MS-Off Ver
    2010
    Posts
    10

    Save Active sheet as .pdf - file error

    Good afternoon,

    I'm currently running VBA;

    Please Login or Register  to view this content.
    The file generates and saves as a .pdf, however upon opening the file, it pops up that it's unable to open because it is either not supported, corrupt or not decoded correctly

    Any ideas how to fix this?

    Thanks,
    PQ
    Last edited by AliGW; 03-23-2017 at 09:53 AM. Reason: Code tags added as a courtesy this once - please do this yourself in future posts. Thanks.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Save Active sheet as .pdf - file error

    Welcome to the forum
    Try swapping out the SaveAs line for this:

    Please Login or Register  to view this content.
    Next time - record a macro and see what Excel writes - it may need modifying but it is very useful for getting the syntax and file types etc correct


    Also please edit your original post and select your VBA code and then click on # icon to wrap code tags around it
    thanks
    Last edited by kev_; 03-23-2017 at 08:09 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

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

    Re: Save Active sheet as .pdf - file error

    PQ, welcome to the forum. Please take the time to read the Forum Rules.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    @ kev_

    Since you specify Type no need to add the extra ".pdf" (also notice the extra dot in front of pdf). It's added automatically upon saving.
    Last edited by bakerman2; 03-23-2017 at 08:46 AM.
    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.

+ 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 active sheet
    By VilMarci in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-06-2018, 12:00 PM
  2. [SOLVED] Save an active csv file into a given directory
    By plans in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2017, 12:46 PM
  3. save .xlsx from active sheet, with sheet name, same address of current workbook
    By Mikeswell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 12:14 PM
  4. [SOLVED] save active sheet in new workbook, naming it as cell value of active sheet
    By arkharova.s in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2014, 06:16 AM
  5. [SOLVED] Copy row from active file to another formated excell file and save as one cell value
    By snsuvarna in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2013, 04:18 AM
  6. [SOLVED] VBA to save active sheet as new file with save as option
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2013, 10:54 AM
  7. [SOLVED] Create a bouton to save as a pdf a another sheet then the active sheet using a custom name
    By sunny_island2002 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-14-2012, 08:01 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