Range.Borders(xl-Border Designation Enumeration?)

Feb 14, 2013 at 5:50 PM
I'm trying to figure out how to set my borders in a macro. This is what the vba would look like

With ActiveSheet.Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(15, 15))
With .Borders(xlEdgeTop)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
With .Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
With .Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
With .Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
With .Borders(xlInsideHorizontal)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
With .Borders(xlInsideVertical)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlThin
End With
End With

I'm trying to do this with C#:

dynamic range = app.ActiveSheet.Range(app.ActiveSheet.Cells(1, 1),app.ActiveSheet.Cells(results.Count + 2, 13));
range.Borders(xlEdgeTop).LineStyle = xlContinuous;
range.Borders(xlEdgeTop).ColorIndex = 0;
range.Borders(xlEdgeTop).TintAndShade = 0;
range.Borders(xlEdgeTop).Weight = xlThin;
.
.
.

But this C# won't compile with all of the excel enumeration references. Is it common practice to track down the integers associated with these enumeration values? I'd like to have them in here for readability purposes. I guess I could define my own enumeration... Just trying to learn the most common approach. Is it possible or am I going about this in the wrong manner?
Coordinator
Feb 15, 2013 at 12:04 PM