View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.charting
ramkumar_cpt
 
Posts: n/a
Default Got error in Shapes.AddShape()


Got error in this statement.

xlApp.Sheets(1).Shapes.AddShape(msoShapeRectangle, 60.75, 222.75, 6,
6).

Its working fine in Macro. I tried run this macro code using Visual
basic application. It is not working.

My vb code is..

Dim xlApp As Excel.Application '// Hold reference
to Excel Application
Dim xlWrkbk As Excel.Workbook '// Hold reference
to Full Template Excel
Dim objWorkSheet As Excel.Worksheet '// Hold reference
to Excel sheet

Private Sub Command1_Click()

'Initialize the Excel Application Properties
Set xlApp = New Excel.Application
xlApp.Visible = True


'// Open the Report Excel and the Full Template Excel
Set xlWrkbk = xlApp.Workbooks.Open("C:\ram.xls")
Set objWorkSheet = xlWrkbk.Worksheets("ProjectKPIs")

'// Display the link at start page
With xlApp.Sheets(1).Shapes.AddShape(msoShapeRectangle, 60.75,
222.75, 6, 6)
.Fill.ForeColor.SchemeColor = 18
End With

End Sub

Thanks in advance
Ram.


--
ramkumar_cpt
------------------------------------------------------------------------
ramkumar_cpt's Profile: http://www.excelforum.com/member.php...o&userid=28673
View this thread: http://www.excelforum.com/showthread...hreadid=522536