How to Convert Excel to PDF using Blueprism

Sukesh Kumaru

Active Member
This is an Interview Question, how to convert Excel data to pdf using blueprism.
Please share your valuable knowledge whether it is possibe or not, if possible how.
 

michalides

New Member
Hi,

have you already solved this? I have the same problem.

I created a separate object where I copied "Save Workbook As" stage from MS Excel VBO and used following code from the video instead of the original one:

Code:
    Dim wb as Object  = GetWorkbook(handle,workbookname)
    Dim excel as Object = wb.Application

    excel.DisplayAlerts = False

    wb.ActiveSheet.ExportAsFixedFormat (Type:=0, Filename:="C:\sample.pdf", Quality:=0, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False)
    
    excel.DisplayAlerts = True

However I'm still getting following error:

Description: Compiler error at line 1: 'GetWorkbook' is not declared. It may be inaccessible due to its protection level.
Repairable: No

When I include also the beginning and ending of the original code from "Save Workbook As" stage (like below) I get another error.

Code:
newworkbookname = ExecWithTimeout(Timeout, "Save Workbook As",
Function()

    Dim wb as Object  = GetWorkbook(handle,workbookname)
    Dim excel as Object = wb.Application

    excel.DisplayAlerts = False

    wb.ActiveSheet.ExportAsFixedFormat (Type:=0, Filename:="C:\sample.pdf", Quality:=0, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False)
    
    excel.DisplayAlerts = True

    Return wb.Name
End Function)

Description: Compiler error at line 1: 'ExecWithTimeout' is not declared. It may be inaccessible due to its protection level.
Repairable: No

Can someone please advise?

Thanks
 

mdhazlee

New Member
Hi @michalides , you'll need to make adjustments and remove ActiveSheet from line 9 and it should work.


Code:
newworkbookname = ExecWithTimeout(Timeout, "Save Workbook As",
Function()

    Dim wb as Object  = GetWorkbook(handle,workbookname)
    Dim excel as Object = wb.Application

    excel.DisplayAlerts = False

    wb.ExportAsFixedFormat (Type:=0, Filename:="C:\sample.pdf", Quality:=0, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False)
    
    excel.DisplayAlerts = True

    Return wb.Name
End Function)
 

Ajith Reddy

New Member
Hi, I used the above code.
But still i am getting compile error.
Could any please help me in converting excel sheet to pdf.
 

khushbu Desai

New Member
Hi ,
When i used code as mention by michalides. i am getting below Error.
'workbookname' is not declared. it may be inaccessible due to its protection level how can i resolve this?

Please help to resolve this
 

khushbu Desai

New Member
Hello All,

Please watch My Video for "How easily we can create PDF from excel using RPA blue Prism. "




Regards,
Khushbu Desai
 
Last edited:
Top