Insert/Attach Zip folder in the Excel file using VBA code

Hi All,
I have a project requirement where I need to insert/attach Zip folder (which includes multiple excel and pdf files) into an excel file.

Note: I have already created the Zip folder using Compress/Zip files activity. The only thing I am trying to figure out to attach the Zip folder in the excel file.

Hi, could you please specify what exactly you would like to achieve? A hyperlink to the zip file or attaching the zip file directly in the worksheet?

Best regards
Szymon

enable excel macro and try it

if the file path to the zip folder changes dynamically, you can pass it as an argument to the VBA macro by modifying the code slightly to accept input parameters.

To attach a Zip folder to an Excel file in UiPath, you can use the “Insert Object” feature in Excel.
Use the Invoke VBA activity to insert the Zip folder as an object. You can write a small VBA script to handle this
try out with this script

Sub InsertZipFile()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1") ' Change to your sheet name
    ws.OLEObjects.Add _
        Filename:="C:\path\to\your\zipfile.zip", _
        Link:=False, _
        DisplayAsIcon:=True, _
        IconFileName:="C:\Windows\System32\shell32.dll", _
        IconIndex:=0, _
        IconLabel:="Your Zip File"
End Sub