Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Save Excel worksheet as PDF

  1. #11
    New Member
    Join Date
    Mar 2014
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Save Excel worksheet as PDF

    Hi John,

    i just changed value in cell I8 to 123-45679-000 and file got saved.

    but i would not like to use "-" in my invoice no.

    so is it possible that this invoice no with from cell I8 gets copied in cell M1, remove the special characters and then M1 is used for file saving.

  2. #12
    MrExcel MVP
    Join Date
    Oct 2007
    Posts
    5,896
    Post Thanks / Like
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Save Excel worksheet as PDF

    "/" isn't valid in file names because it separates folder names. This code replaces "/" with "_":
    Code:
    fname = Replace(Sheets(1).Range("I8"), "/", "_") & " - " & _
                Sheets(1).Range("A11") & " - " & _
                Sheets(1).Range("H11") & ".pdf"
    Edit - or if you want every "/" omitted then:

    Code:
    fname = Replace(Sheets(1).Range("I8"), "/", "") & " - " & _
                Sheets(1).Range("A11") & " - " & _
                Sheets(1).Range("H11") & ".pdf"
    Last edited by John_w; Oct 18th, 2019 at 12:01 PM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •