问题一:以下代码中,xlDiagonalDown、xlContinuous、xlEdgeLeft这些符号常量,哪儿可以查到。
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
问题二:要学好VBA,需要看什么书,请大家帮忙推荐一下。
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
问题二:要学好VBA,需要看什么书,请大家帮忙推荐一下。
EXCEL自带的VBA帮助手册中
LineStyle 属性
参阅应用于示例特性返回或设置边框的线型。XlLineStyle 类型,可读写。XlLineStyle 可为以下 XlLineStyle 常量之一。
xlContinuous
xlDash
xlDashDot
xlDashDotDot
xlDot
xlDouble
xlSlantDashDot
xlLineStyleNone XlLineStyle常量 值
xlContinuous 1
xlDash -4115
xlDashDot 4
xlDashDotDot 5
xlDot -4118
xlDouble -4119
xlLineStyleNone -4142
xlSlantDashDot 13
MsgBox xlNone
MsgBox xlContinuous
MsgBox xlMedium
MsgBox xlAutomatic
MsgBox xlDiagonalDown
MsgBox xlDiagonalUp
MsgBox xlEdgeLeft
MsgBox xlEdgeTop
MsgBox xlEdgeBottom
MsgBox xlEdgeRight
MsgBox xlInsideVertical
MsgBox xlInsideHorizontal
End Sub
debug.print "变量名 =" & 变量的值
debug.print "变量名 =" & 变量的值
这样打印一下就清楚了。
B)在代码中选中该常量,右键菜单\定义,可以跳到对象浏览器并直接定位
经常用的是直接debug.print
LineStyle 属性
参阅应用于示例特性返回或设置边框的线型。XlLineStyle 类型,可读写。XlLineStyle 可为以下 XlLineStyle 常量之一。
xlContinuous
xlDash
xlDashDot
xlDashDotDot
xlDot
xlDouble
xlSlantDashDot
xlLineStyleNone expression.LineStyle
expression 必需。该表达式返回“应用于”列表中的对象之一。示例
本示例为 Chart1 的图表区和绘图区域设置边框。With Charts("Chart1")
.ChartArea.Border.LineStyle = xlDashDot
With .PlotArea.Border
.LineStyle = xlDashDotDot
.Weight = xlThick
End With
End With