deletesection does not delete rows

M

miked

I am trying to change Visio shapesheet attributes using VBA. Using
Deletesection deletes the section but when you use addsection to put a new
section of the same type back in the section appears witl ALL previous rows
on the first call to AddRow.
Microsoft documentation clearly states that all rowa are automatically
deleted when you delete the section. (See
http://msdn.microsoft.com/library/d...ssdk11/html/vimthDeleteSection_HV81900482.asp).

Is this working correctly or is there an unknown bug or is the documentation
wrong.

To show you what I mean here is the general code flow with comments:

' Create a shape with 3 rows in section User, Prop, or Action
Set sh = (set the shape)
' Delete the section
sh.DeleteSection VisSectionAction
' Now add a new section
sh.AddSection visSectionAction
' Here is where the wierd bits start
' Show the shapesheet in the visio window and have a look at the section.
The section exists but with no lines. you can programatically confirm this
with the code:
Debug.Print sh.Section(visSectionAction).Count
'The count comes back as 0
' Next add a row
sh.AddRow visSectionAction, VisRowLast, <rowtype>
Debug.Print sh.Section(visSectionAction).Count
' The results return 4 , 3 original rows plus the added row.
' If you now look ad the shapesheet you can see the original 3 rowsplus the
new row.
 
J

JuneTheSecond

I've ested your code, and it worked normal.
I've tested on a new single rectangle on a new drawing.
 
P

Paul Herber

1. Which version of Visio?
Visio 2007 adds a Properties Action automatically when the Action
section is added.

2. Which shape? Standard or your own? May be relevent?

3. Are there any add-ons loaded which may be detecting the add or
delete section event? Which actions are being (re-)added?
 
M

miked

Yes you are right. I have also just tested it on a new rectangle in a new
document and it worked.
Upon further investigation I discovered that the actual document was
corrupt. I copied all my unchanged code and stencils into new documents and
it all worked perfectly.
 

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