Issue while ussing WorkBook.Save method in Invoke method

studio

#1

Hi all,
Could anyone please help me as i am facing issue while using the save method of excel workbook in Invoke Method where i am giving Save as method name and TargetObject ExcelFileName.CurrentworkBook. i am getting the following error

"wORKBOOK DOES NOT HAVE A PUBLIC INSTANCE METHOD NAMED SAVE MATCHING THE PARAMETER TYPES, GENERIC TYPE ARGUMENTS AND GENERIC TYPE CONSTRAINTS SUPPLIED TO INVOKE METHOD ".

Please help me with this


#2

Hello,

On target object of your invoke method you can try passing this instead.

CType(ExcelWorkbookScope.CurrentWorkbook, Microsoft.Office.Interop.Excel._Workbook)

Note that most of the UiPath Activity such as write cell/range will save your workbook once they will append it so that call might not be effectively required…

Cheers.


#3

@Florent_Salendres Could you breif it i am not able to understand it


#4

image

No validation error if you use

CType(ExcelFileName.CurrentWorkbook, Microsoft.Office.Interop.Excel._Workbook)

Cheers


#5

@Florent_Salendres still facing the issue


#6

@adrian @vvaidya @badita could you plesae help me with this


#7

This error might be either related with your “imports” as you see under or another Custom activity package/older UiPath version you are using.

image

My recommendation is that you start to reproduce the part you were making in a New Workflow, from my side using last UiPath version it works fine.

You also have the option to use Invoke Code passing your ExcelWorkbookApplication object as argument and use the .save from there.

Good luck


#8

Hi @Florent_Salendres

I am struggling with the save method as well, however i am using word. Anyway you can guide me how to accomplish this?

image


#9

Hi,

Are you inside a Word application scope when you execute your logic?
Because your changes should be automatically saved once you reach its end.

In case you would be worried that your scope may not complete, you could use Append text within an empty string.

Let me know if those workarounds work for you.

Cheers


#10

Hi,

No i am not using the word application scope. Attached you have the workflow. I am reading a excel table and inputting the data in a word document, everything works, but i cant save the document after i have input the data. In other words i just need to invoke a method that saves the word document at the end of the process. Can you please take a look? :slight_smile:
Word.zip (22.5 KB)


#11

I maganaged to bypass validation error using this expression as TargetObject value.

Ctype(wordDoc,Microsoft.Office.Interop.Word.DocumentClass)
Changing variable type for wordDoc should work as well

Does this work from your side?

Cheers


Inserting the data to word table
#12

That did the trick! Thanks you :slight_smile: