Exception When Accessing Shapes

A

alon.albert

I am working on a small Visio Addon where I added a DocumentOpened
event handler that needs to iterate all the shapes.

Whenever I access doc.DocumentSheet.Shapes however, I get the following
exception:

Exception: System.Runtime.InteropServices.COMException (0x86DB089B):

Cannot create object.

at Microsoft.Office.Interop.Visio.ShapeClass.get_Shapes()

at Tutorial.Connect.onDocumentOpened(Document doc) in
q:\visiotest\tutorial\connect.cs:line 70


Any ideas? Other things like adding attributes to the shape when it is
dropped seem to work fine.
 
D

David Parker [Visio MVP]

The DocumentSheet does not have any Shapes.

A Document has Pages and a Page has Shapes

Document.Pages(n).Shapes....
 
S

sailurao

Hello,
I am working on #C project that allows the user to create shape
using Visio and I am able to bring Viso document on the Window form
create shapes,saving them etc. Now I am wondering How to access thos
shapes, so that I want to change the color or text of the shape to dra
the user attention for any wanings etc. Does any one know how to d
this? I will appreciate the help.

Thanks,
Naga
 

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