Hi Everyone,
I am very new to developing in Visio using VBA. I am currently attempting to get a Master Shape that is dropped onto a Foreground Page to match its' PinX, PinY, Width, and Height properties to a shape that already exists on the page.
I have include some simplified code to illustrate where my challenge is occurring. The Width of the shape (rectangle.5) that is already on the foreground page is returning a correct value. When the master shape is dropped onto the page the Width propery is 0 in. -- it should be 2.5 in. and I can not set it to the Width of (rectangle.5) -- I assume that If I learn the proper syntax and formating for the width, the PinX,PinY, and Height properties will be set the same way.
I do not think that I am accessing the Master Shapes cell properties correctly. It says in the "Developing Visio Solution" book that "to work with formulas of a Master,. use the PageSheet property of the object. which returns a Shape object. You can then use the Cells property of that Shape object to work with its formulas." this is not working for me.
Can you please provide some examples or some thoughts.
< code >
Dim shpObj As Visio.Shape
Dim celObj As Visio.Cell
Dim mastCelObj As Visio.Cell
Set shapeObj = ActivePage.BackPage.Shapes.Item("Rectangle.5"
' This works. celObj is set to 3.127 in.
Set celObj = shapeObj.Cells("Width"
Dim mastObj As Visio.Master
' Get the Master property of the dropped shape
'This works. mastObj is set to the name of the master
Set mastObj = Shape.Master
'This is incorrect. It is set to 0 in. It shoudl be 2.5 in.
Set mastCelObj = mastObj.PageSheet.Cells("Width"
Thank You,
:-(
I am very new to developing in Visio using VBA. I am currently attempting to get a Master Shape that is dropped onto a Foreground Page to match its' PinX, PinY, Width, and Height properties to a shape that already exists on the page.
I have include some simplified code to illustrate where my challenge is occurring. The Width of the shape (rectangle.5) that is already on the foreground page is returning a correct value. When the master shape is dropped onto the page the Width propery is 0 in. -- it should be 2.5 in. and I can not set it to the Width of (rectangle.5) -- I assume that If I learn the proper syntax and formating for the width, the PinX,PinY, and Height properties will be set the same way.
I do not think that I am accessing the Master Shapes cell properties correctly. It says in the "Developing Visio Solution" book that "to work with formulas of a Master,. use the PageSheet property of the object. which returns a Shape object. You can then use the Cells property of that Shape object to work with its formulas." this is not working for me.
Can you please provide some examples or some thoughts.
< code >
Dim shpObj As Visio.Shape
Dim celObj As Visio.Cell
Dim mastCelObj As Visio.Cell
Set shapeObj = ActivePage.BackPage.Shapes.Item("Rectangle.5"
' This works. celObj is set to 3.127 in.
Set celObj = shapeObj.Cells("Width"
Dim mastObj As Visio.Master
' Get the Master property of the dropped shape
'This works. mastObj is set to the name of the master
Set mastObj = Shape.Master
'This is incorrect. It is set to 0 in. It shoudl be 2.5 in.
Set mastCelObj = mastObj.PageSheet.Cells("Width"
Thank You,
:-(