How to set background color to particular range and set border to complete sheet using VB.net as office is not installed in my machine

How to set background color to particular range and set border to complete sheet using VB.net as office is not installed in my machine. Currently using below script.
it work fine for background color but border is not working

Hi @TUSHAR_DIWASE

Check the below thread.

Regards

Hi @TUSHAR_DIWASE ,

Row no 12 of your code the LineStyle property expects a value from the XlLineStyle enumeration, not an RGB color value.

Dim rng As Microsoft.Office.Interop.Excel.Range = ws.Range("A5:A10")
rng.Borders.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous
rng.Borders.Color = RGB(255, 0 ,0)

could you try the above code.

Microsoft docs:-

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