我正在尝试格式化给定的范围。下面代码中一个类的 BorderStyle 属性的值是“xlMedium”,它是字符串数据类型,但是权重属性需要 xlMedium 作为常量,我如何将这个字符串值转换为常量?
谢谢你。
Function applyFormat(ByRef objRng As clsRange)
' Select the Range
Worksheets(objRng.SheetName).Select
Worksheets(objRng.SheetName).Range(objRng.RangeValue).Select
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = (Me.BorderStyle)
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = (Me.BorderStyle)
End With
End Function