エクセルVBAのWith~End With構文
Win2000エクセル2000です。
下記のMacro11はTEST11のようにWith~End Withでくくれると思うのですがエラーになります。
どこがおかしいのでしょうか?
Sub Macro11()
ActiveSheet.Shapes.AddShape(msoShapeSun, 450, 150, 120, 120).Select
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.ForeColor.SchemeColor = 64
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
Selection.ShapeRange.Fill.OneColorGradient msoGradientFromCorner, 1, 0.59
Selection.ShapeRange.Adjustments.Item(1) = 0.3016
Selection.ShapeRange.ThreeD.SetThreeDFormat msoThreeD7
Selection.ShapeRange.ThreeD.PresetMaterial = msoMaterialMetal
Selection.ShapeRange.ThreeD.Depth = 144#
End Sub
Sub TEST11()
With ActiveSheet.Shapes.AddShape(msoShapeSun, 450, 150, 120, 120)
.ShapeRange.Line.Weight = 0.75
.ShapeRange.Line.ForeColor.SchemeColor = 64
.ShapeRange.Fill.ForeColor.SchemeColor = 10
.ShapeRange.Fill.OneColorGradient msoGradientFromCorner, 1, 0.59
.ShapeRange.Adjustments.Item(1) = 0.3016
.ShapeRange.ThreeD.SetThreeDFormat msoThreeD7
.ShapeRange.ThreeD.PresetMaterial = msoMaterialMetal
.ShapeRange.ThreeD.Depth = 144#
End With
End Sub
お礼
watabe007様 有難うございました、解決しました。