PDF_to_Excel conversion

Step 1 : Open new excel

Step 2 : View Tab

Step 3 : Click to Macro drop down

Step 4 : Select Record Macro

Step 5 : Macro Name -> “PDF_To_Excel”

Stpe 6: Stop recording macro

Step 7 : Sheet1 – > Right click -> viewcode -> open Module

Step 8 -> copy and paste below code

Sub PDF_To_Excel()

‘ PDF_To_Excel Macro

Dim setting_sh As Worksheet
Set setting_sh = ThisWorkbook.Sheets(“Sheet1”)
‘Declare variable input and output file path.
Dim pdf_path As String
Dim excel_path As String
‘Input file Path
pdf_path = setting_sh.Range(“A1”).Value
‘Output File Path
excel_path = setting_sh.Range(“A2”).Value

Dim fso As New FileSystemObject
Dim fo As Folder
Dim f As File

Set fo = fso.GetFolder(pdf_path)

Dim wa As Object
Dim doc As Object
Dim wr As Object

Set wa = CreateObject(“word.application”)

‘Dim wa As New Word.Application
wa.Visible = True
‘Dim doc As Word.Document

Dim nwb As Workbook
Dim nsh As Worksheet
‘Dim wr As Word.Range

For Each f In fo.Files
Set doc = wa.documents.Open(f.Path, False, Format:=”PDF Files”)
Set wr = doc.Paragraphs(1).Range

Set nwb = Workbooks.Add
Set nsh = nwb.Sheets(1)

nwb.SaveAs (excel_path & “\” & Replace(f.Name, “.pdf”, “.xlsx”))

doc.Close False
nwb.Close False


End Sub

Step 9: Save Macro.

Step 10: Open Uipath Studio

Step 11: Please follow below attached screen shot,

Step 12: Save workflow and excute.

Happy learning.

Leave a Reply

%d bloggers like this: