+ Reply to Thread
Results 1 to 26 of 26

save as pdf not working

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    save as pdf not working

    I am using the following code to save two tabs in my workbook as a pdf. I am getting an error and I am not sure why. The fault is happening on the activesheet.expoetasfixedformat line. I can get it to work when I sub in thisworkbook for activesheet but then it creates for every tab in the workbook and not just the two I need. What is the magic syntax to just save the two tabs listed?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    here ya go

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: save as pdf not working

    Attachment 784908
    Still getting a problem message

  4. #4
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    this will work... it's written so you can add more sheets if you need to.
    Please Login or Register  to view this content.
    Last edited by carlmon; 06-23-2022 at 01:46 PM.

  5. #5
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Two possible problems:
    (1) Need to specify where is I2;
    (2) Conflict between "filename" and "filename".

  6. #6
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    Define I2 before... for example

    I can help you out more if you can show me where the error is occurring.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: save as pdf not working

    Quote Originally Posted by carlmon View Post
    Define I2 before... for example

    I can help you out more if you can show me where the error is occurring.
    Please Login or Register  to view this content.

    I am not really sure how to add the STR into the file name path. This is what I have so far.
    Please Login or Register  to view this content.
    The red is where I am having the issue. Really all I want to do is add the current date into the name. So, it would be "Inbound gap report for 6/24/2022" or whatever. There is probably a better way to do it.
    Last edited by chriswrcg; 06-24-2022 at 08:12 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    you can't have "/" in file names...

    It's frustrating but it's how windows read file locations e.g. users/carlmon/files

    with the "/" it thinks there is a file or folder after the slash

    write this for str:
    Please Login or Register  to view this content.
    and it should resolve your issue... and sorry, I didn't realize you wanted to PDF all the sheets at once. I wrote it to PDF each sheet individually.

  9. #9
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: save as pdf not working

    This is really getting frustrating. Still will not work. I have to be adding STR in wrong.
    Attachment 785002

  10. #10
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    filename:=FolderPath & "Inbound Gap Report " & Format(Date,"mm/dd/yyyy") &".pdf" .....

  11. #11
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Adjust as required:

    Please Login or Register  to view this content.
    Last edited by ACCM; 06-24-2022 at 10:24 PM.

  12. #12
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    Post your workbook if you can. It's the easiest way for me to help you... again ACCM you can't have "/" in a file name.. try it yourself and save a file with "/" in it, you'll get an invalid character warning
    Last edited by carlmon; 06-27-2022 at 12:17 PM.

  13. #13
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    Quote Originally Posted by chriswrcg View Post
    This is really getting frustrating. Still will not work. I have to be adding STR in wrong.
    Attachment 785002
    read the top yellow banner for attaching photos or files... for whatever reason the logical way of doing it doesn't work

  14. #14
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Dear Carlmon,
    The FolderPath is not the file name. In the example above the file name is mnopq.Besides, it is not "/" but "\".
    Thanks.

  15. #15
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: save as pdf not working

    ACCM, you can't have a forward or backslash in the filename OR the folder path

    Edit - you can't have a "\" in the file name that is in the full file path, which is what ACCM was doing ... you can obviously have a "\" when going to the folder path
    Last edited by carlmon; 06-27-2022 at 12:18 PM.

  16. #16
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: save as pdf not working

    Hello Chris,

    Just going back to your opening post, try it as follows (there are some notes in the code to help):
    Please Login or Register  to view this content.
    I hope that this helps. I'm off to bed!

    Good night,
    vcoolio.

  17. #17
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    The last example is not what Chris wants (1 pdf containing all required sheets).

  18. #18
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: save as pdf not working

    Hello Chris,

    I've just re-read your opening post and realised that you would like one PDF for all selected sheets so I've amended the code in post #16 as follows:-

    Please Login or Register  to view this content.
    I've assumed that Sheets("Production") does have a capital 'P'.
    You shouldn't have any more problems with the date value.

    I hope it helps.

    Cheerio,
    vcoolio.

  19. #19
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Hi vcoolio,
    Please Login or Register  to view this content.

  20. #20
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: save as pdf not working

    Firstly:
    Why did you place a comment between code tags?

    Secondly:
    I didn't look at post #11 and had no need to now that I have looked at it.
    BTW, in the code in post #11, there is absolutely no need to activate the workbook. It obviously has to be open(activated) to be worked on!

    ...................and what's more, do you realise that you have used an illegal character (/) in the date format of that code which is just going to cause a new problem for the OP?
    Last edited by vcoolio; 06-25-2022 at 09:18 AM.

  21. #21
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Sorry if I bothered you. It was not the intention. Although I am not new around here, I am now starting to participate more actively and therefore I am not yet fully familiar with the rules.
    BTW, what is the problem with the character (/) in the date? It is correct, off course. You are not telling me that the date format dd/mm/yyyy is not a regular one?
    Regards.

  22. #22
    Registered User
    Join Date
    07-07-2013
    Location
    Macau
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: save as pdf not working

    Dear vcoolio,
    I see with surprise that not only you (please see thread above) but also other participants do not 'like' too much the slash character. In that case I promise to 'try' not to use it again.
    Have a nice day.

  23. #23
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: save as pdf not working

    And another similar but not the same possibility!!!
    Please Login or Register  to view this content.
    Experience trumps academics every day of the week and twice on Sunday.

  24. #24
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: save as pdf not working

    @ Jolivanes:

    I like it!
    I also like the quote at the bottom of your post!

    @ACCM:

    BTW, what is the problem with the character (/) in the date? It is correct, off course. You are not telling me that the date format dd/mm/yyyy is not a regular one?
    It is just and Excel quirk that can be annoying. However, that is how Excel is programmed to operate. A good way to find out is to try your own code in a sample workbook. You'll either see that nothing happens or you may receive an error message (1004). This is most common in worksheet names but will still apply to the 'format date' as in your code. Here is an interesting article by Mr. Excel, Bill Jelen, which will help you to understand. Even he is dumbfounded by some of Excel's quirks:

    https://www.mrexcel.com/excel-tips/w...orksheet-name/

    Cheerio,
    vcoolio.

  25. #25
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,498

    Re: save as pdf not working

    @vcoolio
    Thank you very much for the kind words. And that from an Aussie!!!!!!!!! (tongue in cheek here)

    The quote is an unfortunate truth in todays world in my opinion.

  26. #26
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: save as pdf not working

    No worries Jolivanes. It's always good to see alternative methods.
    As for the quote, I couldn't agree more.
    Keep on Excelling!

    Cheerio,
    vcoolio.

+ 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] Save as .PDF not working
    By Wouldsman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2014, 12:22 PM
  2. Click SAVE to save new file - not working correctly
    By vettenfun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2011, 12:38 PM
  3. Save As stopped working after Save As csv
    By pokeyarw in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-28-2010, 10:18 PM
  4. Save/Save As not working in Excel 2003
    By CorneliusM in forum Excel General
    Replies: 0
    Last Post: 02-01-2010, 11:12 AM
  5. Save as not working
    By RANDY IN NC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2006, 04:52 PM
  6. Worksheet Buttons (Save, Save As, Cut, Paste, etc.) Not Working
    By SuzieQ12345 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-21-2005, 11:06 AM
  7. .Save / Not Working
    By djrforb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2005, 01:10 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