VBA CommandBars command usage

G

Gary

Can someone explain how the commandbars works in visio for various toobars???

I have been trying to figure how to change the weight of an ink object. I
think is not part of Visio directly and as such there is no VBA code able to
control it.

I can select it on the menu and change the ink weight via the menu. So I
was trying to use the commandbar vba command to do the same thing.

I was planning on doing a selectAll using VBA, the use the Commandbar
command to change its weight.

The toolbar for the Ink is called Ink and under the Ink toolbar is
Formatting. I want to select the LineWeight 5. How do I do that???

I would appreciate any help or suggestions!!!

Thank You,

Gary
 
M

Mark Nelson [MS]

I believe the answer is that ink cannot be manipulated through Visio's API.
Ink is a Foreign Object in Visio, meaning that the image contents are not
defined in the Shapesheet. If you save a document with ink as XML, the ink
is a binary blob within the XML. If you macro record with ink, you'll find
that the ink manipulation commands are disabled. Finally, if you try to use
DoCmd(1956) to invoke the Ink Properties command directly, Visio returns an
error - meaning that the command is not callable in that fashion.

I can't think of a way around this.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Gary

You are correct! I tried everything you said. I was able to find all the
Ink objects as Foreign Objects. I also tried Macro recorder and the Ink
actions are all disabled. That is when I believe the toolbar approach was
the only option.

I have noticed the following: If I manually used the toolbars, I can get
the results I can. For example, if I select all, and then use the "Ink"
toolbar and select "Ink Thickness" and then select "2 pt" as the thickness,
all of the Ink or foreign objects Ink thinkness increase. That is the effect
I been trying to get.

I have done this:
appVisio.CommandBar("Menu Bar").Controls("Edit").Controls("Select
All").accDoDefaultAction - This uses the tool bar to "Select All" and I see
the results.

I next tried:
appVisio.CommandBar("Ink").Controls("3 Felt-Tip Pen").accDoDefaultAction
This does select the 3 Felt-Tip Pen from the "Ink" toolbar. I am no sure
what the .accDoDefaultAction does?? Without it, it doesn't work for those
examples.

If I can this this to work, then I should be able to accomplish my goal:
appVisio.CommandBar("Ink").Controls("Ink Thickness") At this point is where
I need help. The "Ink Thickness" is a Drop Down List Box which contains
various Ink Thickness selection (1 pt, 1-1/4 pt, 1-1/2 pt, 1-3/4 pt, 2 pt,
etc).

I don't know how to make a selection or what action command that I need???

Can You Help!

I think there is another approach is to select all of the Ink objects and
convert them over to geometry and change the line width of those objects
only?? I am not sure how to use the convert to geometry command in VBA code.
I think I can find all of the foreign objects (sometimes they are group
within groups and that makes it harder).

Thanks,

Gary
 

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