
Object Reference Not Set to an Instance of an Object
I found this problem...I had some VBA code running on the
BeforeSelectionDelete event that was deleting the object. Disabling that
code so that VBA doesn't try to delete the object at the same time VB.Net is
trying to delete it fixed it.
Thanks,
Chuck
Quote:
> I have a VB.Net routine that opens a Visio document and deletes a shape
> object as follows
> Dim vsoShape as Visio.Shape
> For Each vsoShape in vsoPage.Shapes
> vsoShape.Delete
> Next
> I step through the code using the de{*filter*} and when it gets to the line
> vsoShape.Delete that deletes the object, Visio deletes the object, but the
> DotNet code declares an error "Object Reference Not Set to an Instance of
an
> Object".
> The object was there when the instruction was executed, but it was deleted
> by the instruction and it is naturally not there when the instruction
> completes. It looks like DotNet is declaring an error at that point
because
> the object is no longer there.
> Has anyone else seen this problem? Is there a solution or a work-around
for
> it?
> Thanks,
> Chuck