Reference "1-D Endpoint" section (of a Shape) in V Basic Macro?

H

Homero Noboa

I need to get BegingX and BegingY values of Dynamic Connectors. They belong
to the 1-D Endpoints section but I cannot figure out how to reference this
section in my program.
I have tried
MyValue =
ActiveDocument.Pages.Item(1).Shapes.Item(77).CellsSRC(SectionNumber, 0,
1).Formula

with SectionNumber varying from 0 to 255 without succes.

Any help would be appreciated.
 
S

shashi behari

i know you're doing this with VB, but this is how it's done with C#
(shouldn't be too hard to translate)

instead of using page references, use individual shapes instead,
so you would do this

foreach(Shape shape in Pages)
{...}

then you want to check if the shape is in fact a connector like this:

if(shape.OneD != 0)
{...}

if it gets this far then you can try accessing the 1-D Endpoints section

shape.get_CellsSRC((short)visSectionObject, (short)visRowXForm1D,
(short)vis1DBeginX).Formula

shape.get_CellsSRC((short)visSectionObject, (short)visRowXForm1D,
(short)vis1DBeginY).Formula


hope this helps... might be slightly different for VB but the basic
"algorithm" should be the same.
 
M

Mark Nelson [MS]

There are several Sections that you can see in the Shapesheet Window that
are not really sections. They are really rows within the Object section.

If you are looking for resources to help explain the Shapesheet, check out
Graham Wideman's Visio 2003 Developer's Survival Pack.
http://www.diagramantics.com/
 
H

Homero Noboa

Shasi.

Thanks for your time and effort. I tried to understand your explanation but
I cannot do your first step (I think I could do the following) but
foreach(Shape shape in Pages)

is beyond me. Could you please elaborate a little more on the foreach keyword?
 
H

Homero Noboa

So, how can I browse through this rows? I have tried the CellsSRC and
CellsSRCExists properties with no luck.

Since I don't know the names of the rows, I cannot use the Row or the
RowExists properties

Any suggestion?
 
S

shashi behari

foreach is a for-loop that will repeat for every object in an array

foreach(Object obj in Array)
{ Print(obj) }
is the same as using

(for i=0; i < Array.Count;i++)
{ Print(Array) }

except that you don't use array indices (Array)
 
M

Mark Nelson [MS]

Are you still asking about 1-D endpoints? The code to access those is shown
in Sasha's reply below.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mark Nelson [MS]

Oops. Apologies. Shashi is the correct name.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
H

Homero Noboa

Thanks for the help. It worked.

Finally I was able to locate those criptic properties.

Thanks again.

Regards,

Homero.




shashi behari said:
foreach is a for-loop that will repeat for every object in an array

foreach(Object obj in Array)
{ Print(obj) }
is the same as using

(for i=0; i < Array.Count;i++)
{ Print(Array) }

except that you don't use array indices (Array)


Homero Noboa said:
Shasi.

Thanks for your time and effort. I tried to understand your explanation but
I cannot do your first step (I think I could do the following) but


is beyond me. Could you please elaborate a little more on the foreach keyword?
 

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