Org Charts Auto-arrange in VBA

VISIO

    Sponsored Links

    Next

  • 1. visio on sharepoint
    this is still a follow on to my file exists problem. I now help myself using If Documents.CanCheckOut(file) however now I am in the position that I would like to know the file modification date. The files are all on sharepoint, to make things difficult, all of them are on different shared libraries on different sharepoint sites. So I looked into the sharedworkspace object. The problem is that from the docs I get the impression, that I only get that object, if I have an active document, not if I only have the url. Does anyone knows an object that leads me on the right track, or is it simply not possible?
  • 2. programmatically creating dfx or dwg files from scratch
    We are interested in an API of some kind that will allow us to programmatically (in code) create *.dwg or *.dfx drawing files from scratch. We would not have a source drawing to start from so it we are looking for more than a save as. I see that Visio has the ability to save files in the format we need. I was wondering if anyone has attempted to automate the creation of drawings. I was thinking about using interop automation to create the drawing and then save it to dfx or dwg format. We would like to create these drawings as a service so we would want to have to interact with a user interface. Has anyone attempted this before? Is there a better way to satisfy our requirements? If anyone has any insight or ideas on this topic your comments would be most appreciated. Thanks, Jeff
  • 3. Part of dropped shape drawn in wrong position
    My application uses automation to delete and drop new shapes on my diagram as corresponding values are changed in an excel spreadsheet. Very occasionally when a new shape is dropped on the diagram, part of the shape is drawn in the wrong place. It appears that a part of the shape, such as a line is drawn on the diagram, but using its position within the master shape, so appears at the bottom left of the diagram. Any suggestions
  • 4. Print current view
    Is there any way I can set the "Current View" option in the "Page Range" for printing. My user will have zoomed in and ideally I would like a button on my command bar that will print the screen rather than the diagram. Thanks
  • 5. Adding a menu on built-in menu bar when opening document.
    I am going to add a menu item on built in menu bar when i open the document. But the menu dissapears as soon as it appears. when I am going to add using Office CommandBar object. Would anyone advice me what is wrong? Any comments or advice would be appreciated. Of couse, there is no problem when I use UIObject. But I wish to know the reason why it dissapears when i use Office Command Bar object. There was no problem in Excel, when I tried the same code on opening the work sheet. The code I am trying is as follows. Thank you for your comments in advance. [ThisDocument] Sub document_documentopened(ByVal doc As IVDocument) AddMenu1 End Sub [Module1] Sub AddMenu1() Dim myMenuBar As Office.CommandBar Dim newMenu As Office.CommandBarControl Dim ctrl1 As Office.CommandBarControl Set myMenuBar = Application.CommandBars.ActiveMenuBar Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True) newMenu.Caption = "Menu1" Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1) ctrl1.Caption = "TEST" ctrl1.OnAction = "test" ctrl1.TooltipText = "Menu Made by me" ctrl1.Style = msoButtonCaption End Sub Sub test() MsgBox "TEST" End Sub --- JuneTheSecond

Org Charts Auto-arrange in VBA

Postby peter.allan » Thu, 28 Sep 2006 18:05:24 GMT

Hello, I'm trying to automate the creation of org-charts using Visio
VBA. I can create the org charts and do a certain amount of
manipulation, however I am struggling to "re-arrange" the shapes on the
page once the chart has been created.

The Org Chart Wizard tends to put subordinates in 2 columns below a
Manager, even where there are 30 or 40 subordinates and the shapes run
off the bottom of the pages. Manually I can improve this by selecting
the Manager, going to Shape -> Actions -> Arrange subordinates on the
menu, and clicking on the relevant button to re-arrange the shapes into
4 columns.

So is there any way I can run this 'auto-arrange' option in VBA ? I
cannot find anything in the Language References on the Microsoft site.

Even better would be some examples of how I can 'move' shapes around
the page more generally so I can move into (for example) 6 columns.

I have also seen reference on here to changing the orgch_u.vst file,
however I don't have one on my pc (I'm using Visio 2000), and I don't
know if it would help in this case anyway.

Any help is greatly appreciated,
Thanks,


RE: Org Charts Auto-arrange in VBA

Postby SnVuZVRoZVNlY29uZA » Thu, 28 Sep 2006 20:50:01 GMT

Sometimes you can get the name of command and parameter
by analysing the menu with vba, though it is not always true.

-- 
JuneTheSecond  


Re: Org Charts Auto-arrange in VBA

Postby Chris Roth [MVP] » Wed, 04 Oct 2006 20:16:55 GMT

Hi Peter,

I found one of my posts from a few weeks ago related to this topic, and have 
pasted it below. Have a look!

-- 
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio

-----------------------------------------------------
Org Chart Commands
-----------------------------------------------------
Two ideas:

One, you can analyze the Orgchart menu via Visio's UI object to see what the
commands are. Since I don't do this sooo often, I always forget and find it
a bit of a pain...just laziness really.

Two, select an orgchart shape and choose Window > Show ShapeSheet. In the
Actions section, you'll see a bunch of formulas with RUNADDONWARGS. The
add-on is called OrgC11, and you can see a whole slew of parameters that can
be fed to it.

Looking at this, I took a lucky guess and figured "/cmd=LayoutPage" would do
what you needed. Sure enough it works. So you can test in VBA using this
line of code:

Call Visio.Application.Addons.ItemU("OrgC11").Run("/cmd=LayoutPage")
-----------------------------------------------------










Re: Org Charts Auto-arrange in VBA

Postby peter.allan » Sat, 14 Oct 2006 19:01:08 GMT

Hi Chris,

Thanks for your reply. Regarding the info in your post - when I look at
the ShapeSheet for the employees in my Org Chart the RUNADDONWARGS
seems to be different from yours - there is no add-on called "orgc11",
and no /cmd=Layoutpage option. The only add-on is "orgc".

Do I need to get a new version of Visio (I'm currently using Visio Pro
2002 SR-1) ?

Or is this "orgc11" add-on downloadable, or installable, somehow ?

Thanks very much for any help,
Regards,
Peter.









Re: Org Charts Auto-arrange in VBA

Postby John Marshall, MVP » Sun, 15 Oct 2006 04:45:27 GMT

isio 2003's version number is 11, so orgc11 would be for Visio 2003.

John... Visio MVP

Need stencils or ideas? http://visio.mvps.org/3rdparty.htm
Need VBA examples? http://visio.mvps.org/VBA.htm
Visio Wishlist http://visio.mvps.org/wish_list.htm

< XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



Similar Threads:

1.auto-refresh org chart pictures/hyperlinks from database?

I'm creating an org chart in Visio 2003 that is linked to a database.
I can get the employee data to update in the chart but I would like to
get the inserted pictures and hyperlinks to update based on a path/etc.
contained in database fields.  I've been digging through the Visio
developer help but haven't come up with much so far.  Any help would be
appreciated.

Thanks

2.Org Chart or Flow Chart Control

Hi

Can someone recommend a Org Chart or a Flow Chart Control which I could use 
with vbs?

I would only use the control to display a chart. Functions for modifications 
like an Editor is not a need.

Thank's
Michel 


3.Insert Picture in Org. Chart - VBA

How can i insert any picture to any shape in org. chart 
with VBA? 
OR 
Could i link picture from Access database?

4.Org Chart Data Import using VBA?

I would be very interested in that code, as that is what I am trying to
accomplish...


Dan Sears wrote:
> I wrote some VBA code in MS Access to create an org chart with VISIO
without
> using the import feature.
> I use tables in the Access app to supply the data. I open Visio from
the
> VBA, drop the top manager, then drop the rest of the employees in
their
> proper positions based on the "ReportsTo" field. If you're interested
I
> could e-mail you a copy of the mbd.
>
>     Dan Sears
>
>
> "Randal Greene" < XXXX@XXXXX.COM > wrote in message
> news:OnnftUsqBHA.1596@tkmsftngp07...
> > I'd like to automate creating an org chart using data we have in
our
> > Access/SQL HR app.  Visio has a simple feature for
importing/exporting org
> > data via csv, however I can't seem to access the org data
import/export
> > feature using VBA.  Is this possible?  If not, I am new to Visio
VBA, so
> > what is the basic approach to creating the org chart object by
object
> using
> > code - do you use the Shapes collection?
> >
> > Thanks in advance...
> >
> >

5.auto-refresh org chart pictures/hyperlinks from database?

I'm creating an org chart in Visio 2003 that is linked to a database.
I can get the employee data to update in the chart but I would like to
get the inserted pictures and hyperlinks to update based on a path/etc.
contained in database fields.  I've been digging through the Visio
developer help but haven't come up with much so far.  Any help would be
appreciated.

Thanks

6. Auto arrange child shapes in parent shape

7. Move org chart without auto-rerouting

8. Auto change position type using custom properties in Org chart



Return to VISIO

 

Who is online

Users browsing this forum: No registered users and 95 guest