Unable to Set the LineStyle Property of the Border Class?

China☆狼群 提交于 2020-01-07 02:25:34

问题


 With Sheets(1).Range(Cells(row + 1, 1), Cells(row + 1, "V"))
     .Interior.ColorIndex = 48
    ' .Borders (xlInsideHorizontal)
 .LineStyle = xlSlantDashDot
 .Weight = xlThin
 .ColorIndex = 15
 .Font.Name = "Times New Roman"
 .Font.Size = 25
     End With

    .LineStyle = xlSlantDashDot

This is the line showing the error .

Is it about the MS office version ?

I m using MS officer 2010 version .

Or this property is too old ,that I can 't use xlSlantDashDot .

Any other excel cell thick linestyle suggested ?


The error is

XL2002: Error Message: Run-Time Error 1004: Unable to Set the LineStyle Property of the Border Class

https://support.microsoft.com/en-us/kb/277577


回答1:


If you intend to set the borders of your range, then You need to modify your line:

.LineStyle = xlSlantDashDot

to:

.Borders.LineStyle = xlSlantDashDot


来源:https://stackoverflow.com/questions/39033906/unable-to-set-the-linestyle-property-of-the-border-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!