Guidance on Embedding Excel in Word using UiPath

@tejaskumar.darji,

It seems that there is no direct activity available in UiPath Studio to embed an Excel file into a Word document as an object directly. However, you can utilize the Invoke Code activity to achieve this functionality by using the Microsoft.Office.Interop.Word library.

' Add required namespaces for Word Interop
Imports Microsoft.Office.Interop.Word

' Define variables
Dim wordApp As Application = New Application()
Dim wordDoc As Document = wordApp.Documents.Open("C:\path\to\your\word\document.docx")

' Move to the desired location in the document where you want to insert the Excel file
Dim range As Range = wordDoc.Bookmarks("\endofdoc").Range

' Add the Excel object as an embedded OLE object in the Word document
' Note: Change the path to the actual location of your Excel file
range.InlineShapes.AddOLEObject(ClassType:="Excel.Sheet", _
                                FileName:="C:\path\to\your\excel\file.xlsx", _
                                LinkToFile:=False, _
                                DisplayAsIcon:=True)

' Save and close the document
wordDoc.Save()
wordDoc.Close()
wordApp.Quit()

' Release COM objects
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDoc)
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordApp)

LLM helped me to write this but it’s validated by me.