A
Aussie Susan
I think I'm missing something basic here....
I have a stencil that contains several shapes I have created, along with a
set of VBA code that is stored in the 'ThisDocument' module of the stencil.
I have also created a template that contains a blank page and the stencil
that I want.
I created the VBA code originally in the 'ThisDocument' module of a blank
drawing that I used to create the shapes and test their behaviour - this all
worked.
I have a 'sub Document_DocumentOpened' that I use to set the various
'WithEvents' variables to the active window and the document it contains
(which is not the stencil document but my actual drawing - at least that's
what it seems to me looking at the drawing '.name' property).
However, I am having trouble if I create a new drawing based on the template
file - not all of the macros are not triggered off by my actions. Those
connected to the window seem to be fired, but not those related to the
document (i.e. vsoWindow_SelectionChanged get called, but not
vsoDocument_ShapeAdded).
I think I have a fundamental lack of understanding about how VBA macros
should be used when they reside in the stencil. Is there some sort of
inheritance-like behaviour in how the events find their target procedures
(doubt it!) or is there something that I should be doing to initialise
everything when the document it opened?
Thanks
Susan
I have a stencil that contains several shapes I have created, along with a
set of VBA code that is stored in the 'ThisDocument' module of the stencil.
I have also created a template that contains a blank page and the stencil
that I want.
I created the VBA code originally in the 'ThisDocument' module of a blank
drawing that I used to create the shapes and test their behaviour - this all
worked.
I have a 'sub Document_DocumentOpened' that I use to set the various
'WithEvents' variables to the active window and the document it contains
(which is not the stencil document but my actual drawing - at least that's
what it seems to me looking at the drawing '.name' property).
However, I am having trouble if I create a new drawing based on the template
file - not all of the macros are not triggered off by my actions. Those
connected to the window seem to be fired, but not those related to the
document (i.e. vsoWindow_SelectionChanged get called, but not
vsoDocument_ShapeAdded).
I think I have a fundamental lack of understanding about how VBA macros
should be used when they reside in the stencil. Is there some sort of
inheritance-like behaviour in how the events find their target procedures
(doubt it!) or is there something that I should be doing to initialise
everything when the document it opened?
Thanks
Susan