How to add the bottom borders for select range

Hello Everyone,

How we can add the bottom border for select range in excel using with UiPath.
Please find the below screenshot for reference for how I need:


Please help for for resolution using with UiPath.

Thanks,

@Sandy_G,

You will have to use Invoke VBA for this. No native activity for this.

@ashokkarale,

Thank you for your quick response.
I am trying to using the Invoke code activity, if it is no worked, I will try to use the Invoke VBA

1 Like

hey
if you can use Read Range activity twice like below then try this logic:

paste this in Range field of Read Range activity
"A1:" & chr(64+dt_test.ColumnCount) & dt_test.Rows.Count

@AkshaySandhu,

Thank you for responding.
I already have the range but not able to add the borders.

If we read the data, how to add the borders?

I used the invoke code activity but it is throwing error as below
image

How can I resolve it
Processing: image.png…
Processing: image.png…

screenshots are not visible to me.
you can try below code

Dim objApp As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application()
ObjApp.Visible= False
Dim objSheet As Microsoft.Office.Interop.Excel._Worksheet = DirectCast(objApp.Workbooks.Open("H:\Temp\New Microsoft Excel Worksheet.xlsx").Worksheets("Sheet1"),Microsoft.Office.Interop.Excel._Worksheet)
Dim range As Microsoft.Office.Interop.Excel.Range = objSheet.Range("B2:C6")
With range.Borders(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom)
	.LineStyle = Microsoft.Office.Interop.Excel.xlLineStyle.xlContinuous
	.Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlMedium 
	.ColorIndex = 0
End With
objApp.ActiveWorkbook.Close(True)
ObjApp.Visible= True
ObjApp.Quit

I was not able to test it due to package issue at my side but it should give you some guidance

Thank you, it is working

1 Like

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