INSERT Slide PPT - How to use a variable to define the Image Path

Hello everybody, I am trying to copy a picture from some folder in my local pc to a power point file which was already created. Well it is a quite simple operation , but actually the picture name dynamically change according to some input. So, I create a variable in which the full path is stored, then I would expect to use this variable in Image path, but the following error is displayed. I´ve tried also to convert to string but it does not work. Any suggestions ?

@Salvo71 - YBEPATH.ToString is not correct. YBEPATH is a variable name which you have declared already.

Please create 2 string variables, one for storing the path to the folder (e.g. D:\Temp) and another for storing the image name.

Now you build the complete path to the image by concatenating the two variables.

folderName = “D:\Temp”
imageName - this is for storing the image name

Image path = folderName + imageName

Hello @sreenivasm , yes I did it but results is :
image

even thought the file path is correct ( I checked it using message box ) : Here is what I did :

How I can solve it ? Thanks !

For the record here´s the message box output :

as you can see the path is correct…I do not know how come I still have this error. Any suggestions ? Thanks

@Salvo71 - Is “YBE_1234” a folder or a file? Can you post the values of the folder name and the image file name? The image path should point to a file name.

Ok , let me better explain. Actually the imagine name is composed by two parts, the first one is fixed and is “YBE_” second part is a variable which is linked to the input. So final chart name is
“YBE_” + Variable.

So, this picture is saved in a folder. So now I have to insert the picture into a power point slide. Power point report is located in some folder. Then what I did is:

I created a YBE variable in which I store the full chart name as above explained.
I create another variable ChartsPATH in which I store the chart path and then

into BalaReva section I selected Insert Picture with the following parameters :

File : "power point report path " ex : “C:\Users\Salvator\Documents\UiPath\PEtoolsVer1.1\YieldReport.pptx”

Image Path : ChartsPATH + YBE

what do you think ?

@Salvo71 - OK, assuming your variables are like below:

chartsPath = “C:\Users\Salvator\Documents\UiPath\PEtoolsVer1.1\Charts\”
YBE = “YBE_1234.jpg”

Then the image path would be chartsPath + YBE.

Please ensure that there is a back slash at the end of the chartsPath variable and I think you would also need a image file extension like .JPG or .PNG etc.

Totally right !!! I forgot it !! Of course now is working ! Thanks a lot.

Just last question, do you believe is possible also to “write” the input into a slide in a power point file ? I mean now I made my report with many charts inside but I would also like to change the slide titles dynamically basing on the input from user. What do you think ? Thanks again !

@Salvo71 - I am glad you solved it. Please mark my answer as solution if it helped you.
For adding text, try using the Microsoft.Office.Interop.Powerpoint.

Hello @sreenivasm I marked your answer as a solution. About power point slides title modification I will try your suggestions and let you know. Thanks again for your support !

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