Convert multiple Word file to PDF

How to change mutiple docx to pdf in an instant instead of one file by one file as my current process uses word application etc but is too slow to change each file in a folder to pdf

Hi @superpunchypp ,
So easy
you can use ‘for each file in folder’ with your folder word file
each loop use ‘save document as PDF’


Directory.GetFiles("FolderPath)").Select(Function(a) a.ToString.Replace(".doc",".pdf")).toarray

can you try this once

yes i tried this but it replace each folder one by one i need it to be all at once hence im asking this question, thank you tho

which activity do i put it in and is it possible to show it in UiPath or send your solution for better understanding for me and everyone else


Oh, I think you need convert all word file in a folder to pdf and don’t need keep word file, that’s right?
You can use invoke VB code:

Dim MyApp As New Microsoft.Office.Interop.Word.Application
MyApp.Visible = False
Dim doc As String
For Each doc In System.IO.Directory.GetFiles(InputFolder,“*.docx”)
Dim MyDoc As Microsoft.Office.Interop.Word.Document = MyApp.Documents.Open(doc.ToString)
Mydoc.SaveAs(doc.Replace(“.docx”,“.pdf”), Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF)

hope it help,

i cant use invoke code for my project

please tell me why?
If can not use invoke vb code, we can use activity like my above comment
you can use ‘for each file in folder’ with your folder word file
each loop use ‘save document as PDF’

Only can use Invoke code and for each file in folder am i right?

2 ways can not help you?
could you tell me why?
I think use activity for each file in folder and save as pdf is well
it will short with invoke code above

What’s your way manual in here?

the reason why i ask this question is because your rename process was not using for each folder which will be slow making it one by one, but u use for each activity which rename all the file in folder at once which only take like 10 seconds.

we can convert without open file.
and how about “Invoke code”?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.