Convert .ppt, .xls, .doc to PDF using Blue Prism ?

Hi All,

I have different formats of input files which I need to pick and convert them to PDF and later extract data from that PDF to process.

Can anyone help me how we can Word/Excel/PPT to a PDF using blue prism and what are the objects we can use to extract data from PDF.
For MS Word there is an available Export PDF action available in MS Word VBO. For the other types: xls/ppt, you need to code to convert to pdf.
Last edited:


Well-Known Member
Staff member
No, there is no code already written on the forum but you can use the ExportAsFixedFormat for the Excel file with the help of the below links. You need to create the relevant Workbook/Worksheet objects which you can find in the code stages of the other Excel VBO actions or some on the forum.

Likewise there is the same method for Powerpoint files.


Well-Known Member
Staff member
I happened to install the pdf add-in on my machine and used the below code to generate the pdf.

- Create a new object action inside the Ms Excel VBO and have the Start and Code stages as below. I made a duplicate copy of the Open Workbook stage and used it.
View attachment 1541067028154.png

- Start stage Input parameters:
View attachment 1541066786337.png

- Code stage Input parameters:
View attachment 1541066688041.png

- Code stage:
View attachment 1541066911511.png
Dim wb as Object = GetInstance(handle).Workbooks.Open(filename)
wb.Activate()  'can skip this line
wb.ExportAsFixedFormat (Type:=0, Filename:=FullPdfFilePath, Quality:=0) '0:=xlTypePDF, 0:=xlQualityStandard
'Refer other list of parameters in below link
wb = Nothing
- Input Excel File (Sheet1) and Process Diagram:
I have used the 'Open Workbook' action in the diagram to 'Show' the workbook, you may skip that if you don't need to display.
View attachment 1541066719252.png

- Call to the new action from the Process diagram:
View attachment 1541067120310.png

- Sample Output.pdf (opened in Chrome):
Page 1 from Sheet 1:
View attachment 1541067205313.png

Page 2 from Sheet 2:
View attachment 1541067264173.png
Thanks a lot. The Excel part worked for me :) I have a question on the PPT part. What is the application name I need to give in the code stage? Presentation Application ?. Can I replicate the code stages for Open, and other action stages same as excel vbo?


Well-Known Member
Staff member
Replicating the Excel code will require a bit more coding with all the other code correctly done for creating the Handle etc similar to the one for Excel since it has to be done from scratch. Although that can be done if you are planning to create a new VBO for Powerpoint with your own set of customised actions, and will be re-usable too.

The below code saves a Powerpoint as a PDF.

'If creating a new object with just the Code stage then add Microsoft.VisualBasic 
'to the Namespace Imports section of the Initialise tab

Dim pptApp as Object
Dim pptObj as Object

pptApp = CreateObject("PowerPoint.Application")
pptApp.visible = True

pptObj = pptApp.Presentations.Open("C:\MySavedPPT.pptx")

pptObj.SaveAs("c:\PPTToPdf.pdf", 32) ' 32:=ppSaveAsPDF
'If the Export quality of the pdf is not as expected OR if you need more options like Hidden slides etc,
' then you need to use the other method as in the below link with the additional parameters shown in it

pptObj = Nothing

pptApp = Nothing

'Note: It is observed that in spite of quitting the application in the above
'line of code, the Powerpoint window still remains open. This appears to be
'a common problem among many developers over the internet and so a new action
'in the diagram with a Kill Process on the powerpnt.exe will close the Application window.
PDF generated from a ppt file with 2 slides:
View attachment 1541075954497.png
Thanks again. I tried to use the code and the stage failed as the error said it cannot open the file. See codestage error and codelogic.Also I wanted to make it generic as I have many files and plan to put a loop. Should I give anything in inputs and outputs?

Alternatively I thought Il start a VBO from scratch and replicated excel code for handle and Open.see pic opencode.Do I need to add anything extra But here as well it failed at Open stage. The Export PDF code I planned to place this - Let me know if this works-exportppttpdf.png

Thanks inadvance for your help!



Well-Known Member
Staff member
Hi mmanasa2525,

Do double check the path of the file. Also is your file a ppt instead of pptx?

The custom code you have used is that of a Workbook which is applicable to Excel but in Powerpoint the objects are Presentations and Slides. Also for the GetInstance function to work you will have to take a look at the Initialise tab -> Global code of the Ms Excel VBO, modify everything refers to a Worksheet and a Workbook and develop a similar function for Powerpoint including most of the other functions written in that tab. This is the reason I mentioned that it requires more coding to develop from scratch although you still can continue if you have the time, patience, energy, and lots of research :).
The file is pptx opened the instance of the file but it says cannot open the file ..I just changed the path to my file ..will there b any custom code for ppt n different for pptx


Well-Known Member
Staff member
No separate code for ppt/x. Have you had to add the Visual Basic namspace mentioned at the top of the code?
Not sure what's wrong with the file. Are you able to zip the file and attach after removing any sensitive information?
Yes the file has data just put one slide and added Microsoft.Visual Basic in Namespace imports too. Do I need to pass any inputs apart from code ?Did you create any Open instance object too before you export to PDF? I just put code stage and ran


Well-Known Member
Staff member
Yes the file has data just put one slide and added Microsoft.Visual Basic in Namespace imports too. Do I need to pass any inputs apart from code ?Did you create any Open instance object too before you export to PDF? I just put code stage and ran
Yes it has just a single Code stage with the namespace added. Did you try with other files too?
Hey It worked now with other PPT. Not sure what went wrong :) By the way I can add inputs to this in generic fashion and give it right ? Instead of hardcoding the paths?


Well-Known Member
Staff member
The above code is to get started on the conversion of ppt to pdf and can be customised as per requirement.