Using custom properties in Visio program

J

jmlight0

I have created some "custom properties" for shapes that I use in my Visio
diagram. These properties allow me to store useful information (such as
"author", "location", etc) with each specific instance of a shape on the
page. How do I access these values from a Visio program? I have looked thru
the documentation and code samples, but could find no reference to the syntax
used to access the values of these custom properties on specific shapes.
Thank you.
 
A

Andy

Simply as follows,

dim vsoShape as Visio.Shape
dim strLocation as string

set vsoShape = ....

strLocation = vsoShape.Cells("Prop.location").ResultStr(0)
 
J

jmlight0

Thank you for the help. Unfortunately, when I ran the code you suggested, I
got the following error:

Run-time error '-2032466967(86db03ed)":
Unexpected end of file

To make sure that I didn't have extraneous things influncing the test, I
created a new sheet with only one shape and only one custom property (named
"location"). I got the same results.

Please help me debug this and, to avoid many future problems, direct me to a
good book or useful on-line documentation on Visio programming. So far, I've
been proceeding in a 'trial and error' mode (heavy on the error). It is
frustrating and likely uncecessary given the maturity of the Visio product.
Thank you.
 
A

Al Edlund

As an observation the code offered appears to be VBA and the error code is
similar to that given by VB.NET. You might try something like this

dim vsoShape as visio.shape
dim vsoCell as visio.cell

vsoShape = (however you selected it)

if vsoShape.cellexists("prop.location",false) then
vsoCell = vsoShape.cells("prop.location")
msgbox cstr(vsocell.formula)
else
msgbox "cell does not exist"
end if

or an on-line tutorial

http://msdn.microsoft.com/library/en-us/devref/HTML/DVS_01_Introduction__544.asp?frame=true

for books, examples, and pointers, check John Marshall's site
(www.mvps.org/visio)

al
 

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