VBA Code to save Files to a selected Folder

ShamimIT

New Member
Joined
Mar 24, 2022
Messages
3
Office Version
  1. 2010
Platform
  1. Windows
Hello Everyone,

I am looking for a simple code.

What i want to do that i have 2 sheets in a excel file. Input sheet contains 100 people result data & Output sheet is Individual person result sheet. So the idea is when i run the macro, in the second sheet it put 1 people information details with details result, then convert it into PDF file & automatically save the PDF file to desktop.

The code working perfectly but what i want that, there will be Folder Selection dialog box at the begining for the process by which i will select the folder where all the PDF files will be stored after conversion. Below is my code :

Sub ALL_PDF()

Dim lastrow As Long, RA As Long
lastrow = Sheets("Trainee_Database").Cells(Rows.Count, "A").End(xlUp).Row
For RA = lastrow To 2 Step -1

Sheets("Trainee_Database").Select
Range("A" & RA).Select
Selection.Copy
Sheets("10072F").Select
Range("C10").PasteSpecial Paste:=xlPasteValues

Sheet1.Range("A1:J58").ExportAsFixedFormat xlTypePDF, Filename:="C:\Users\Asus\Desktop\PDF\10072F\" & Sheet1.Range("C10").Value, openafterpublish:=False

Next RA

End Sub
 

Attachments

  • Exm.PNG
    Exm.PNG
    15.6 KB · Views: 5

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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