+ Reply to Thread
Results 1 to 18 of 18

Export to PDF error

  1. #1
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Export to PDF error

    Hi all,

    First time post here. Moderately new to VBA and still trying to find my feet.

    I am trying to set up up some code to export my active sheet to a PDF, but i keep getting the following message.

    Capture.JPG

    I can say for sure that there file does not already exist and it is not already open. Below is the code I am trying to get to work.

    Please Login or Register  to view this content.
    I would apprichiate any help or feedback.

    Thanks

    Wheeler
    Last edited by WheelerWarrior; 09-06-2016 at 04:56 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    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.

    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



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    Apologies, still learning the way with this forum. I have fixed the post

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    I think you create it twice so after it's created it does it again.

    Here, try this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    That seem's to still return the same error message. I think I should provide some more context.

    I am trying to print a workout program for multiple athletes.

    Capture1.JPG

    When I click on the save as pdf Macro button it brings up the following user form.

    Capture2.JPG

    From here I can/want to be able to select which athletes programmes get saved as a pdf. I have this function working if I want to print. so I tried to apply the same code for save as pdf. The full code I am using is below.

    Please Login or Register  to view this content.
    If further explanation is required please let me know

    cheers

    Wheeler

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    It will always save it with same name. Why don't you put variant name so it won't be duplicated?

  7. #7
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    I hadn't done that because I don't know how to do that to be honest.

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    Something like this (didn't test it):

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    Same error is still appearing (Run time 1004) but previously i could actually see the pdf start to publish then fail. Now nothing.

    This is the debug I get

    Capture55.JPG

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  11. #11
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    The file is too big. It's 1.3 mb

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    remove all irrelevant informations. Delete extra rows... Keep just what's important for example.
    You can also zip it.

  13. #13
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8

    Re: Export to PDF error

    please find the file attached. Note the macro i am trying to get to work is the save as pdf but on the tab named workout card
    Attached Files Attached Files

  14. #14
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    It's protected.

  15. #15
    Registered User
    Join Date
    09-06-2016
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    8
    Quote Originally Posted by zbor View Post
    It's protected.
    Password is warrior

  16. #16
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    As I thought, once you create file for first user it opens it and then you can't create file with same name.
    But this works for me:

    Please Login or Register  to view this content.

  17. #17
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    I've use Add all and create all pdf for each user under his name and current date.

    that's how all files are opened but with different name so no error appear.

    Untitled.jpg
    Last edited by zbor; 09-06-2016 at 08:28 AM.

  18. #18
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Export to PDF error

    It fails only at the part where you have some strange names in the list as: ****AASE****

+ 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. [SOLVED] ActiveSheet will not export to PDF - runtime error 5
    By physicsgal in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-28-2016, 03:37 PM
  2. Pivot Table Export Run-Time Error
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2015, 07:19 AM
  3. Error when try to export Excel data to Access
    By Nelliebeanz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2014, 09:02 AM
  4. Save\export specific worksheet error
    By SarahPintal in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-23-2010, 05:12 PM
  5. Automation Error when trying to export
    By maximus73 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2007, 01:14 PM
  6. [SOLVED] Export to Tab Delimited Text Error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2006, 11:25 AM

Tags for this Thread

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