• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help me to create multiple PDF files with cell value as file name

uranus99

New Member
Hello my name is Roger.
I wanna create multiple PDF files with cell value as file name.

i found this code in internet
Code:
Sub Rectangle1_Click()
On Error Resume Next
   MkDir ThisWorkbook.Path & "\SAVE AS PDF\"
   On Error GoTo 0

Filename = Sheets("Card").Range("B1") & "-" & Sheets("Card").Range("B2")
If Sheets("Card").Range("B1") = "" Then
MsgBox "Invalid", vbCritical, "Failed to Save"
Exit Sub
Else
   With ThisWorkbook.ActiveSheet
       fName = Filename
   End With
   '
   'export to pdf
   ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
               ThisWorkbook.Path & "\SAVE AS PDF\" & fName, Quality:=xlQualityStandard, _
               IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

MsgBox "File " & Filename & ".pdf successfull save as PDF", vbInformation, "Convert To PDF"
End If
End Sub

Score.png
upload_2019-2-13_11-42-44.gif
Card.png
upload_2019-2-13_11-42-44.gif

with that code, I can only save one data that appears on the sheet card.
Can anyone help me to Save all data as PDF in Score sheet in the form of Card Sheet just one click?? so i can have multiple PDF files
 
uranus99
What data (which range) would You try to 'save as PDF' from 'Score'-sheet?
You would modify code:
1) take away that With ... End With
2) change ActiveSheet to Sheets("Score")
3) .. and someway tell ... which range

>> Upload a File to get a quicker response <<
 
uranus99
What data (which range) would You try to 'save as PDF' from 'Score'-sheet?
You would modify code:
1) take away that With ... End With
2) change ActiveSheet to Sheets("Score")
3) .. and someway tell ... which range

>> Upload a File to get a quicker response <<
From A1 to B3.
I want to have All pdf file (total 15 PDFs) with sheet "Card" format from ID 10001 to 10015 with just one click.
i hope someone know the Code so i can do that
 

Attachments

  • Practice.xlsm
    18.7 KB · Views: 3
Last edited:
uranus99
If You ask .. all then You should mean all...
If would have asked other way, it won't need to do many things...
Just for sure, I did third version too - - You can name which IDs...
 

Attachments

  • Practice.xlsm
    24 KB · Views: 14
uranus99
If You ask .. all then You should mean all...
If would have asked other way, it won't need to do many things...
Just for sure, I did third version too - - You can name which IDs...
thank you very much you know what i need.
i really appreciate your help.

but to be honest that file only for my practice.
my true project has 5000 data and i cant upload coz of privacy.
im still noob on coding and need more practice.

i still need your hand.
my project print area is A1 to AP103
and file name on O12"-"O22
which code that i need to change from ur last file to make what i looking for?
 
uranus99
Sample File should have same layout as use, especially if 'still noob'.

All matters ... all matters!
With print area, it's possible to help
... select Your needed range from that sheet and
'set print area' via menu as with any other cases.

Other 'settings' depends of
a) which version of those three or all?
b) what else there would be ...?
c) and so on...
 
Back
Top