Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a border to Excel cells using Visual FoxPro 6

Status
Not open for further replies.

MISHH

MIS
Jan 16, 2003
2
GB
Hi, I have written some FoxPro Code to draw a border around some existing cells. However, I can't get it to work:

lnLine = lnLine + 2
XLSheet.Cells(lnLine,1).value = "Count of Source"
XLSheet.Cells(lnLine,1).bordercolor = 0
lnLine = lnLine + 1
XLSheet.Cells(lnLine,1).value = "Country"
XLSheet.Cells(lnLine,2).value = "Source"
XLSheet.Cells(lnLine,3).value = "Total"

Has anyone got any ideas? :)
 
MISHH

This would do it for you:
Code:
o = CREATEOBJECT("Excel.Application")
wb=o.Workbooks.Add()
mySheet=wb.Worksheets("sheet1")
mySheet.Range("a1:b28").BorderAround(6)
o.Visible=.t.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks very much Mike, that worked perfectly!
 
an another solution,
part from my excel class

#DEFINE xlHAlignCenter -4108
#DEFINE xlVAlignCenter -4108
#DEFINE xlMedium -4138
#DEFINE xlThick 4
#DEFINE xlInsideHorizontal 12
#DEFINE xlInsideVertical 11
#DEFINE xlDiagonalDown 5
#DEFINE xlDiagonalUp 6
#DEFINE xlEdgeBottom 9
#DEFINE xlEdgeLeft 7
#DEFINE xlEdgeRight 10
#DEFINE xlEdgeTop 8
#DEFINE xlContinuous 1
#DEFINE xlDash -4115
#DEFINE xlDashDot 4
#DEFINE xlDashDotDot 5
#DEFINE xlDot -4118
#DEFINE xlDouble -4119
#DEFINE xlSlantDashDot 13
#DEFINE xlLineStyleNone -4142

lccursor=this.lccursor &&cursor adý

yer=sys(2023)
ex=createobject("excel.application")
ex.visible=.t.
ex.workbooks.open(yer+"\&dosya")

IF this.kutucizgi=.t.
ex.ActiveWorkbook.ActiveSheet.UsedRange.Borders.Linestyle = xlContinuous
ELSE
ex.ActiveWorkbook.ActiveSheet.UsedRange.Borders.Linestyle = xldouble
ENDIF

* this code make its for you without define the ranges only draw boxes used ranges...
ActiveWorkbook.ActiveSheet.UsedRange.Borders.Linestyle = xldouble
Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top