Save Excel worksheet as PDF

Akshay_divecha

New Member
Joined
Mar 11, 2014
Messages
33
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.
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
5,951
"/" 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:

Forum statistics

Threads
1,078,252
Messages
5,339,097
Members
399,277
Latest member
Jyoti C

Some videos you may like

This Week's Hot Topics

Top