投稿日 | : 2006/04/20(Thu) 10:43 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: VBからEXCELに図形を描画させ線の太さを変更したい |
せっかく、コードを掲載するなら事象が再現できるコードを投稿するとレスも付き易いかと
思いますよ。
例えば、With .Selection の .Selection は何に対してなのか肝心な部分が解らないし、
上記コードでエラーは発生しないのかどうかも解らないし。
一度下記コードを試して見て下さい。
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlApp.Visible = True
Dim xlShape As Excel.Shape
Set xlShape = xlSheet.Shapes.AddShape(msoShapeRectangle, 412, 138, 146.25, 45.75)
With xlShape
.Line.Weight = 6
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoTrue
End With
Set xlShape = Nothing
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub