Update shape instances when master shape is changed

  • Thread starter -CaptainPugwash-
  • Start date
C

-CaptainPugwash-

I've got a Visio drawing with about 300 instances of a master shape. When I
change some of the properties of the master shape it updates all the
instances as expected, after it prompts me for whether I want to update all
the instances of the master shape.

However, I want to make a change to the master shape with some VBA code and
get all the instances to update automatically. I have written some code
that seems to do this, but it doesn't always update all the instances.
Could someone paste a snippet of code that would do this to check that I am
on the correct lines, and furthermore, is there a way in VBA to tell it to
update all the instances after a change has been made to the master shape
(as the prompt would usually do, if the changes were made manually to the
master).

Many thanks.

PugWash
 
C

Chris Roth [ Visio MVP ]

Might be the old master copy deal. Assuming your master contains only one
(grouped if necessary) shape inside of the master container, do this:

Dim mst as Visio.Master, mstCopy as Visio.Master
Dim shp as Visio.Shape

Set mst = Visio.ActiveDocument.Masters("CapnP")
Set mstCopy = mst.Open

Set shp = mstCopy.Shapes(1)
shp.Cells("Prop.FirstMate").Formula = Chr(34) & "Gilligan" & Chr(34)
'....
Set shp = Nothing

mst.Close

set mstCopy = Nothing
Set mst = Nothing



--

Hope this helps,

Chris Roth
Visio MVP
 

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