If so, is there any suitable introductory documentation, i.e not aimed
at experienced VB programmers only? An example of the sort of task I
have in mind would be a one-click tool button to reformat a selected
line (e.g so that it becomes thicker and gets a solid arrow at its
end).
Terry, West Sussex, UK
Terry, West Sussex, UK
This is a tricky post to reply to, because what you think should be
*really* easy is actually a bit convoluted in Visio.
First, the VBA macro itself is relatively easy: Simply use the
ActiveWindow.Selection
object to determine what shapes are currently selected, and then
manipulate them:
Shapes.Cells("somecell").Formula = "= some new formula or value"
This macro can then at least appear on the Tools > Macros list.
However, getting it to appear on a toolbar is a bit more effort. To get
any elements added to the user interface (menuitem, toolbaritem,
accelerator key or statusbaritem) you have to master the
CustomMenus/CustomToobars area of Visio functionality.
In brief, Visio provides a mechanism in which numerous entire suites of
menu/toobar/statusbar/accelerators are maintained and alternately
invoked on the fly by Visio according to the "context"... contexts such
as:
-- a drawing window
-- a stencil window
-- a shapesheet window
This entire collection of suites is refered to as the "UI"
Your task is, for example, to copy the fixed built-in UI to the
changeable custom UI, then add your accelerator (or button etc) to the
appropriate context(s). What you add includes a specification of what
you want to happen, such as call a VBA macro.
Most of this is at least discussed in the Developing Visio Solutions
book in PDF on your V2K CD.
Graham
--
-----------------------------------
Graham Wideman
Resources for programmable diagramming at:
http://www.diagramantics.com
www.wideman-one.com
gra...@wideman-one.com.nospam
(Remove the obvious to email me)
-----------------------------------
Many thanks, Graham, that's very helpful. I'll make a start with some
simple VBA work next weekend, and meanwhile have started exploring the
DVS PDF.
So it seems that Visio targets its macro facilities at the
'developer', rather than the 'power user'.
Terry, West Sussex, UK