This project has moved and is read-only. For the latest updates, please go here.

'ShapeRange' is not a member of 'NetOffice.ExcelApi.Shape'.

Apr 11, 2012 at 9:27 AM

Sebastian,

I presume the workaround for below is dim shp as Object but let me ask anyway in case there's a better way:

Dim shp As Shape
shp = ActiveSheet.Shapes(sName)
shp.ShapeRange.AlternativeText = sText 
 

Error 1 'ShapeRange' is not a member of 'NetOffice.ExcelApi.Shape'. 

Apr 11, 2012 at 10:16 AM

the COM type library definition says to me: no ShapeRange property or method is impemented in Excel.Shape
did that works in VBA??

Sebastian

Apr 11, 2012 at 11:14 AM

Sorry. my mistake!

I had originally Selection.ShapeRange and that worked fine and still does, for some reason I had inserted a line to cast

shp = CType( Selection, Shape )

and changed the code to use Shp.

Bit too overkeen on casting, then ;-(

 

 

Apr 11, 2012 at 1:39 PM

just a hint*

all my casting code in netoffice vb.net examples is easier

Dim worksheet As Excel.Worksheet = workbook.Sheets(1) ' defined as sheet while design time
' works fine

Sebastian

Apr 11, 2012 at 2:10 PM

OK, I would never do:

Dim worksheet As Excel.Worksheet = workbook.Sheets(1)

because the first sheet may not be a Worksheet.

I iterate Sheets when I need to list all sheets such as Charts, Dialogsheets, etc, and to then check the Type to see if it's a worksheet before doing more.

I iterate Worksheets when I specifically want only Worksheets.