Page 1 of 1

Rectangle in Excel (Solved)

Posted: Sun Oct 27, 2019 4:25 pm
by driessen
Hello,

From my FWH-application, I want to draw a rectangle around a certain number of cells.
How can I accomplish that?

Thanks a lot for any help.

Re: Rectangle in Excel

Posted: Sun Oct 27, 2019 5:33 pm
by Armando
Michel:

I hope this can help you

Code: Select all

// lines style
#Define xlContinuous 1
#Define xlDash -4115
#Define xlDashDot 4
#Define xlDashDotDot 5
#Define xlDot -4118
#Define xlDouble -4119
#Define xlSlantDashDot 13
#Define xlLineStyleNone -4142

#Define xlEdgeLeft 7
#Define xlEdgeTop 8
#Define xlEdgeBottom 9
#Define xlEdgeRight 10

#define xlThick 4
#define xlMedium -4138
….
….
……
….
….
    oSheet:Cells(nRow,nCol):Borders(xlEdgeLeft):LineStyle := xlContinuous
    oSheet:Cells(nRow,nCol):Borders(xlEdgeLeft):Weight := xlThick
    oSheet:Cells(nRow,nCol):Borders(xlEdgeTop):LineStyle := xlContinuous
    oSheet:Cells(nRow,nCol):Borders(xlEdgeTop):Weight := xlThick
    oSheet:Cells(nRow,nCol):Borders(xlEdgeRight):LineStyle := xlContinuous
    oSheet:Cells(nRow,nCol):Borders(xlEdgeRight):Weight := xlThick
    oSheet:Cells(nRow,nCol):Borders(xlEdgeBottom):LineStyle := xlContinuous
    oSheet:Cells(nRow,nCol):Borders(xlEdgeBottom):Weight := xlThick
 
That's all.

Regards

Re: Rectangle in Excel

Posted: Sun Oct 27, 2019 6:02 pm
by driessen
Waaw,

Great. Thank you so much for your help.