Macro Button in Visio to Open Layer Properties

Started by VisioLearner, June 27, 2017, 04:33:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VisioLearner

Hello,

I have visited this site a lot when learning Visio and I have found it to be extremely useful, thank you for taking the time to establish this forum.

I am a professional intermediate level Visio user. I have recently began to try and learn VBA in order to advance the documentation I produce for the company I work for. I have done a lot of research on the subject of this post but I have not found anything specific to my issue.

I am trying to program a command button that will open up the page layer properties window on the page the viewer is viewing. I wanted to make a button that will do this for the 4 separate pages I have in my Visio Drawing. So far I have read this forum, and as well Microsoft VBA references. I cannot find out what the proper syntax is for referencing the page layer properties window as an object.

I have tried, page.layers.properties.run
                   vso.pageproperties.("name of page").run
and multiple other iterations with no luck.

Is anyone familiar with how to do this? I would appreciate any help/guidance.

Thank you,
VisioLearner

Yacine

Do you really need to work with the original layer window?
A direct manipulation of the layers may be more efficient.
Yacine

VisioLearner

Hello Yacine,

The reason why I am trying to have the button bring up the page layer properties as opposed to programming buttons that toggle the layers are two main reasons.

1.) Some of the individuals interacting with my Visio drawing are not familiar with Visio and do not know how to access the page layer properties. I originally created a READ ME page within the drawing instructing those members of the audience how to access this function but based off of feedback provided they would prefer a button to bring up the "page layer properties" window.

2.) The second reason is there are 8 layers to toggle for each page and I think that would cause more confusion for the type of individuals not familiar with Visio. Also the drawing is a 11x17 diagram that takes up almost all of the page. Finding space within the remainder of the page for 8 different buttons would make things messy.

Is there a way for vba to recognize the page layer properties window as an object based off of the active page being viewed?

VisioLearner

For those viewing and are curious about the answer to this.

The line of code below will open up the Layer Properties window for the active page.

Application.DoCmd (visCmdLayerSetupDlg)

This was a solution offered to me from a user on StackOverflow. I did not find this myself. This post can be considered answered.