[Q] msoShapeRectangle: variable not defined

  • Thread starter Rolf Marvin Bøe Lindgren
  • Start date
R

Rolf Marvin Bøe Lindgren

I'm fairly new to drawing objects in Excel from VBA, and have stumbled
on a peculiar issue. the variable msoShapeRectangle, which apprarently
is suppoed to be predefined, is not declared.

I've recorded the following from Excel:

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 303#, 48#, 255#,250.5)._
Select

compliation is aborted with the error message "msoShapeRectangle :
Variable not defined". if I don't set "Option Explicit" it compiles,
but the value of msoShapeRectangle is Empty. it is used in another
worksheet programmed by somebody else and it works perfectly there.

the variable msoTrue is also undefined.

this is Excel 10 (Excel 2002).

any clues?

thank you,
 
R

Rolf Marvin Bøe Lindgren

NickHK said:
Rolf,
It's from the Microsoft Office library, defined as a MsoAutoShapeType, with
value=1. Maybe you do not have a reference set to this library.

OK, but how do I establish such a referance? as stated, this works in
a workbook that's been made by somebody else - it's in the workbook
that I'm working on that it doesn't work.
 
R

Rolf Marvin Bøe Lindgren

Rolf Marvin Bøe Lindgren said:
OK, but how do I establish such a referance? as stated, this works in
a workbook that's been made by somebody else - it's in the workbook
that I'm working on that it doesn't work.

found it. Tools -> References -> ... lots of stuff.

thanks!
 
N

NickHK

Rolf,
It's from the Microsoft Office library, defined as a MsoAutoShapeType, with
value=1. Maybe you do not have a reference set to this library.

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top