Print to PDF cycle loop through drop-down

AKMAKM

New Member
Joined
Jan 13, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I am using VBA to print to PDF school report card by cycle loop through drop-down

I want to print all report card to pdf and Split and Save PDF to Specific Folder. ( Each folder will be labeled as a Grade and contain pdf files associated with the students for that grade )
-Folders named : Grade 1, Grade 2, Grade 3, Grade 4, Grade 5
-Files named : Macro will save the file by Id number & by cycle loop through drop-down.

However, the below code just need some amendment to enable automate split the files and save into Specific folders:


Sub Print_All_To_PDF()

Dim strValidationRange As String
Dim rngValidation As Range
Dim rngDepartment As Range

Application.ScreenUpdating = False

strValidationRange = Range("B2").Validation.Formula1
Set rngValidation = Range(strValidationRange)

For Each rngDepartment In rngValidation.Cells
Range("B2").Value = rngDepartment.Value
Sheet61.Range("A1:K19").ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\AKAK\Desktop\Grade 1-3\ " & Range("H1").Value & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Next

Application.ScreenUpdating = True
End Sub


Thank you for your help!​



1646857528742.png
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I want to add one more thing that the cell (H1) for the ID number is formula cell
 
Upvote 0
Hello dears, I would appreciate if someone help me on this case.
Best Regards,,,
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top